stores(hydrating): fix no calculation object
This commit is contained in:
parent
7af318617f
commit
0aba06a511
@ -12,13 +12,12 @@ export function initializeStore(initialData) {
|
||||
const _store = store ?? new RootStore();
|
||||
|
||||
if (initialData) {
|
||||
const { user = null, calculation = {} } = initialData;
|
||||
const { values = {}, statuses = {}, options = {} } = calculation;
|
||||
const { user = null, calculation } = initialData;
|
||||
|
||||
_store.$user.hydrate(user);
|
||||
_store.$calculation.$values.hydrate(values);
|
||||
_store.$calculation.$status.hydrate(statuses);
|
||||
_store.$calculation.$options.hydrate(options);
|
||||
if (calculation?.values) _store.$calculation.$values.hydrate(calculation.values);
|
||||
if (calculation?.statuses) _store.$calculation.$status.hydrate(calculation.statuses);
|
||||
if (calculation?.options) _store.$calculation.$options.hydrate(calculation.options);
|
||||
}
|
||||
|
||||
if (typeof window === 'undefined') return _store;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user