Dealing with normalized data #244
-
Previously in Akita I was able to write a query to combine the data from different stores using I have a store that holds reference data for several other possible stores, so I don't want to add it as a Props Factory to each store. Also, it wouldn't work out if all those stores were combined into a single store with multiple entities in this case. Currently I am doing something like this: interface Config {
configId: number
typeId: number
type: Type
}
interface Type {
typeId: number
typeName: string
}
configs$ = combineLatest([
store.pipe(selectAllEntities(), shareReplay({ refCount: true })),
this.typeRepo.types$,
]).pipe(
map(([configs, types]) => {
return configs.map(c => {
return {
...c,
type: types.find(x => x.typeId === c.typeId),
} as Config
})
}),
) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Are you updating both stores at the same tick? |
Beta Was this translation helpful? Give feedback.
Are you updating both stores at the same tick?