Skip to content

Commit

Permalink
Fix a bug where loadEnvironment didn't reset history.
Browse files Browse the repository at this point in the history
Before, there was an undo state at the very beginning for no reason.

Part of #6. Part of #65.
  • Loading branch information
jkomoros committed Sep 22, 2023
1 parent 6519d91 commit 3817a8b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions app/reducers/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -561,15 +561,15 @@ const data = (state : DataState = INITIAL_STATE, action : SomeAction) : DataStat
case LOAD_ENVIRONMENT:
return {
...state,
//TODO: isn't it weird that there's a user visible undo state for this?
versioned: pushVersion(state.versioned, {...currentVersionedState, environment: action.environment}, 'Load environment')
//Note: since we're using initialVersion, the description shouldn't be shown.
versioned: initialVersion({...currentVersionedState, environment: action.environment}, 'Load environment')
};
case CHANGE_ENVIRONMENT_PROPERTY:
return setEnvironmentProperty(state, action.context, action.key, action.value);
case DELETE_ENVIRONMENT_PROPERTY:
return setEnvironmentProperty(state, action.context, action.key, DELETE_SENTINEL);
case LOAD_PACKETS:
//TODO: isn't it weird that there's a user-visible undo state for this?
//Note: since we're using initialVersion (via the final true paremeter) the description shouldn't be shown.
return ensureValidPacketAndSeed(setPacketsOfType(state, action.packetType, action.packets, 'Load packets', true));
case CREATE_PACKET:
const nnnPackets = {
Expand Down

0 comments on commit 3817a8b

Please sign in to comment.