mirror of
https://github.com/stashapp/stash.git
synced 2025-12-09 09:53:40 +01:00
Fix localForage initialization when stored config is undefined
This commit is contained in:
parent
a43cae43c0
commit
a60c89ceb1
2 changed files with 36 additions and 35 deletions
|
|
@ -20,6 +20,7 @@ import Studios from "./components/Studios/Studios";
|
|||
import { TagList } from "./components/Tags/TagList";
|
||||
import { SceneFilenameParser } from "./components/SceneFilenameParser/SceneFilenameParser";
|
||||
|
||||
// Set fontawesome/free-solid-svg as default fontawesome icons
|
||||
library.add(fas);
|
||||
|
||||
export const App: React.FC = () => {
|
||||
|
|
@ -29,31 +30,28 @@ export const App: React.FC = () => {
|
|||
const messages = flattenMessages((locales as any)[messageLanguage]);
|
||||
|
||||
return (
|
||||
<div className="bp3-dark">
|
||||
<ErrorBoundary>
|
||||
<IntlProvider locale={language} messages={messages}>
|
||||
<ToastProvider>
|
||||
<MainNavbar />
|
||||
<div className="main container-fluid">
|
||||
<Switch>
|
||||
<Route exact path="/" component={Stats} />
|
||||
<Route path="/scenes" component={Scenes} />
|
||||
{/* <Route path="/scenes/:id" component={Scene} /> */}
|
||||
<Route path="/galleries" component={Galleries} />
|
||||
<Route path="/performers" component={Performers} />
|
||||
<Route path="/tags" component={TagList} />
|
||||
<Route path="/studios" component={Studios} />
|
||||
<Route path="/settings" component={Settings} />
|
||||
<Route
|
||||
path="/sceneFilenameParser"
|
||||
component={SceneFilenameParser}
|
||||
/>
|
||||
<Route component={PageNotFound} />
|
||||
</Switch>
|
||||
</div>
|
||||
</ToastProvider>
|
||||
</IntlProvider>
|
||||
</ErrorBoundary>
|
||||
</div>
|
||||
<ErrorBoundary>
|
||||
<IntlProvider locale={language} messages={messages}>
|
||||
<ToastProvider>
|
||||
<MainNavbar />
|
||||
<div className="main container-fluid">
|
||||
<Switch>
|
||||
<Route exact path="/" component={Stats} />
|
||||
<Route path="/scenes" component={Scenes} />
|
||||
<Route path="/galleries" component={Galleries} />
|
||||
<Route path="/performers" component={Performers} />
|
||||
<Route path="/tags" component={TagList} />
|
||||
<Route path="/studios" component={Studios} />
|
||||
<Route path="/settings" component={Settings} />
|
||||
<Route
|
||||
path="/sceneFilenameParser"
|
||||
component={SceneFilenameParser}
|
||||
/>
|
||||
<Route component={PageNotFound} />
|
||||
</Switch>
|
||||
</div>
|
||||
</ToastProvider>
|
||||
</IntlProvider>
|
||||
</ErrorBoundary>
|
||||
);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ import {
|
|||
FindStudiosQueryResult,
|
||||
FindPerformersQueryResult
|
||||
} from "src/core/generated-graphql";
|
||||
import { useInterfaceLocalForage } from "src/hooks/LocalForage";
|
||||
import { useInterfaceLocalForage, IInterfaceConfig } from "src/hooks/LocalForage";
|
||||
import { LoadingIndicator } from "src/components/Shared";
|
||||
import { ListFilter } from "src/components/List/ListFilter";
|
||||
import { Pagination } from "src/components/List/Pagination";
|
||||
|
|
@ -134,14 +134,17 @@ const useList = <QueryResult extends IQueryResult, QueryData extends IDataItem>(
|
|||
setFilter(newFilter);
|
||||
|
||||
if (forageInitialised.current) {
|
||||
setInterfaceForage(d => {
|
||||
const dataClone = _.cloneDeep(d);
|
||||
dataClone!.queries[options.filterMode] = {
|
||||
filter: location.search,
|
||||
itemsPerPage: newFilter.itemsPerPage,
|
||||
currentPage: newFilter.currentPage
|
||||
};
|
||||
return dataClone;
|
||||
setInterfaceForage(config => {
|
||||
const data = { ...config } as IInterfaceConfig;
|
||||
data.queries = {
|
||||
...config?.queries,
|
||||
[options.filterMode]: {
|
||||
filter: location.search,
|
||||
itemsPerPage: newFilter.itemsPerPage,
|
||||
currentPage: newFilter.currentPage
|
||||
}
|
||||
}
|
||||
return data;
|
||||
});
|
||||
}
|
||||
}, [location, options.filterMode, options.subComponent, setInterfaceForage]);
|
||||
|
|
|
|||
Loading…
Reference in a new issue