Skip to content

Commit

Permalink
re add get & set functions
Browse files Browse the repository at this point in the history
  • Loading branch information
alexprudhomme committed Jan 8, 2025
1 parent dae91f7 commit 4d417a6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
7 changes: 7 additions & 0 deletions packages/atomic/src/components/common/interface/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@ import {AnyEngineType} from './bindings';

export interface CommonStore<StoreData> {
state: StoreData;
get: <PropName extends keyof StoreData>(
propName: PropName
) => StoreData[PropName];
set: <PropName extends keyof StoreData>(
propName: PropName,
value: StoreData[PropName]
) => void;
onChange: <PropName extends keyof StoreData>(
propName: PropName,
cb: (newValue: StoreData[PropName]) => void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import {
} from '../../common/facets/facet-common-store';
import {
BaseStore,
CommonStore,
createBaseStore,
getFacetElements,
registerFacet,
Expand Down Expand Up @@ -82,7 +81,7 @@ export function createSearchStore(): SearchStore {
facetElements: [],
fieldsToInclude: [],
sortOptions: [],
}) as CommonStore<Data>;
});

return {
...store,
Expand Down

0 comments on commit 4d417a6

Please sign in to comment.