Skip to content

Commit

Permalink
Update React config
Browse files Browse the repository at this point in the history
  • Loading branch information
hugocxl committed Jun 7, 2024
1 parent 1d6e40c commit 4e16484
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
16 changes: 8 additions & 8 deletions packages/react/src/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,24 @@ type Config = {
defaultLocale: Locale | (() => Locale)
loader: Loader
format?: GlobalFormat
persistence?: boolean
persistenceKey?: string
persist?: boolean
storageKey?: string
}

export const config$ = observable<Config>()

export function setupTerai({
defaultLocale,
persistence = false,
persistenceKey = `terai-${pkg.version}`,
persist = false,
storageKey = `terai-${pkg.version}`,
...options
}: Config) {
if (persistence) {
if (persist) {
configureObservablePersistence({
pluginLocal: ObservablePersistLocalStorage
})
persistObservable(state$, {
local: persistenceKey
local: storageKey
})
}

Expand All @@ -50,8 +50,8 @@ export function setupTerai({

config$.set({
defaultLocale,
persistence,
persistenceKey,
persist,
storageKey,
...options
})
}
2 changes: 1 addition & 1 deletion packages/react/src/use-ts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export const useTs = ({ chunkId }: UseTsProps = {}) => {
})
}

if (config.persistence) {
if (config.persist) {
useEffect(() => {
loadDictionary({
locale,
Expand Down

0 comments on commit 4e16484

Please sign in to comment.