diff --git a/pages/index.tsx b/pages/index.tsx index df6928b..e49c38d 100644 --- a/pages/index.tsx +++ b/pages/index.tsx @@ -3,6 +3,7 @@ import { useApolloClient } from '@apollo/client'; import initializeApollo from 'apollo/client'; import * as Calculation from 'Components/Calculation'; import Output from 'Components/Output'; +import defaultOptions from 'config/default-options'; import type { GetServerSideProps } from 'next'; import Head from 'next/head'; import calculateValidationReactions from 'process/calculate/reactions/validation'; @@ -72,13 +73,13 @@ export const getServerSideProps: GetServerSideProps = async ({ req }) => { }); const apolloClient = initializeApollo(); - const { options } = await getCRMData(apolloClient, user); + const { options: crmOptions } = await getCRMData(apolloClient, user); return { props: { user, calculation: { - options, + options: { ...crmOptions, ...defaultOptions }, }, initialApolloState: apolloClient.cache.extract(), diff --git a/stores/index.js b/stores/index.js index 6bd77ea..0cbe3ae 100644 --- a/stores/index.js +++ b/stores/index.js @@ -1,7 +1,6 @@ /* eslint-disable object-curly-newline */ /* eslint-disable @typescript-eslint/naming-convention */ /* eslint-disable no-underscore-dangle */ -import defaultOptions from 'config/default-options'; import { createContext } from 'react'; import RootStore from './root'; @@ -18,9 +17,7 @@ export function initializeStore(initialData) { _store.$user.hydrate(user); 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({ ...defaultOptions, ...calculation.options }); - } + if (calculation?.options) _store.$calculation.$options.hydrate(calculation.options); if (tables?.insurance) { _store.$tables.insurance.hydrate({