Skip to content

Commit

Permalink
refactor: remove server store index, and storage that is default value
Browse files Browse the repository at this point in the history
  • Loading branch information
linonetwo committed Jan 10, 2024
1 parent 6f6d254 commit 45a85ab
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 11 deletions.
4 changes: 2 additions & 2 deletions src/options/Options.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useTranslation } from 'react-i18next';
import { Servers } from '../shared/server';
import { ServersOptions } from './Servers';
import { TiddlerOptions } from './Tiddler';

export function Options() {
Expand All @@ -8,7 +8,7 @@ export function Options() {
<div className='flex flex-col h-screen items-center justify-center bg-gray-50'>
<div className='w-full max-w-2xl p-4 bg-white rounded-lg shadow-lg'>
<h1 className='text-2xl font-bold text-center text-gray-700 mb-4'>{t('Options')}</h1>
<Servers />
<ServersOptions />
<TiddlerOptions />
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/shared/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable unicorn/prefer-top-level-await */
import { preferenceStoreReadyPromise } from './preferences/store';
import { serverStoreReadyPromise } from './server';
import { serverStoreReadyPromise } from './server/store';

export const storeReadyPromise = Promise.race([
serverStoreReadyPromise,
Expand Down
4 changes: 1 addition & 3 deletions src/shared/preferences/store.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
/* eslint-disable @typescript-eslint/strict-boolean-expressions */
import { localStorage } from 'redux-persist-webextension-storage';
import { wrapStore } from 'webext-zustand';
import { create } from 'zustand';
import { createJSONStorage, devtools, persist } from 'zustand/middleware';
import { devtools, persist } from 'zustand/middleware';
import { immer } from 'zustand/middleware/immer';
import { IContent } from '../../popup/hooks/useTransformFormat';

Expand Down Expand Up @@ -46,7 +45,6 @@ export const usePreferenceStore = create<PreferenceState & PreferenceActions>()(
}),
{
name: 'preference-storage',
storage: createJSONStorage(() => localStorage),
},
),
)),
Expand Down
2 changes: 0 additions & 2 deletions src/shared/server/index.ts

This file was deleted.

4 changes: 1 addition & 3 deletions src/shared/server/store.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
/* eslint-disable @typescript-eslint/strict-boolean-expressions */
import { localStorage } from 'redux-persist-webextension-storage';
import cloneDeepRaw from 'rfdc';
import { wrapStore } from 'webext-zustand';
import { create } from 'zustand';
import { createJSONStorage, devtools, persist } from 'zustand/middleware';
import { devtools, persist } from 'zustand/middleware';
import { immer } from 'zustand/middleware/immer';

const cloneDeep = cloneDeepRaw();
Expand Down Expand Up @@ -98,7 +97,6 @@ export const useServerStore = create<ServerState & ServerActions>()(
}),
{
name: 'server-storage',
storage: createJSONStorage(() => localStorage),
},
),
)),
Expand Down

0 comments on commit 45a85ab

Please sign in to comment.