MCPcopy Create free account
hub / github.com/EsperoTech/yaade / currentCollectionReducer

Function currentCollectionReducer

client/src/state/currentCollection.tsx:77–94  ·  view source on GitHub ↗
(
  state: CurrentCollection | undefined = defaultCurrentCollection,
  action: CurrentCollectionAction,
)

Source from the content-addressed store, hash-verified

75 | SetIsChangedAction;
76
77function currentCollectionReducer(
78 state: CurrentCollection | undefined = defaultCurrentCollection,
79 action: CurrentCollectionAction,
80): CurrentCollection | undefined {
81 switch (action.type) {
82 case CurrentCollectionActionType.SET:
83 return set(action.collection);
84 case CurrentCollectionActionType.UNSET:
85 return unset();
86 case CurrentCollectionActionType.PATCH_DATA:
87 return patchData(state, action.data);
88 case CurrentCollectionActionType.SET_IS_CHANGED:
89 return setIsChanged(state, action.isChanged);
90 default:
91 console.error('Invalid action type', action);
92 return state;
93 }
94}
95
96export type { CurrentCollectionAction };
97

Callers

nothing calls this directly

Calls 4

setFunction · 0.70
unsetFunction · 0.70
patchDataFunction · 0.70
setIsChangedFunction · 0.70

Tested by

no test coverage detected