Remove type from Api serialisation of ClientMap
Move the logic that converts the EntityClass of a map to a string and then back into the class to the payload plugin in order to avoid a circular dependency where the ClientMap needs to know the entity classes and the entity classes needs to know the ClientMap. The only place that doesn't know the type of the entities stored in the client map is the payload reviver, so it makes sense to keep this logic contained to the payload plugin.
This commit is contained in:
parent
930d93a95f
commit
d48fb035b4
4 changed files with 70 additions and 91 deletions
|
@ -33,10 +33,7 @@ export const useUsersStore = defineStore("users", () => {
|
|||
const promise = (async () => {
|
||||
try {
|
||||
const apiUsers = await requestFetch("/api/users", { signal: controller.signal });
|
||||
state.users.value.apiUpdate({
|
||||
type: "user",
|
||||
entities: apiUsers,
|
||||
}, { zone, locale });
|
||||
state.users.value.apiUpdate(apiUsers, { zone, locale });
|
||||
state.pendingSync.value = undefined;
|
||||
state.fetched.value = true;
|
||||
return state.users;
|
||||
|
@ -70,10 +67,7 @@ export const useUsersStore = defineStore("users", () => {
|
|||
console.log("appyling", event.data)
|
||||
const zone = Info.normalizeZone(accountStore.activeTimezone);
|
||||
const locale = accountStore.activeLocale;
|
||||
state.users.value.apiUpdate({
|
||||
type: "user",
|
||||
entities: [event.data.data],
|
||||
}, { zone, locale });
|
||||
state.users.value.apiUpdate([event.data.data], { zone, locale });
|
||||
});
|
||||
|
||||
return {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue