mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 20:34:37 +03:00
Fix localForage initialization when stored config is undefined
This commit is contained in:
@@ -20,6 +20,7 @@ import Studios from "./components/Studios/Studios";
|
|||||||
import { TagList } from "./components/Tags/TagList";
|
import { TagList } from "./components/Tags/TagList";
|
||||||
import { SceneFilenameParser } from "./components/SceneFilenameParser/SceneFilenameParser";
|
import { SceneFilenameParser } from "./components/SceneFilenameParser/SceneFilenameParser";
|
||||||
|
|
||||||
|
// Set fontawesome/free-solid-svg as default fontawesome icons
|
||||||
library.add(fas);
|
library.add(fas);
|
||||||
|
|
||||||
export const App: React.FC = () => {
|
export const App: React.FC = () => {
|
||||||
@@ -29,7 +30,6 @@ export const App: React.FC = () => {
|
|||||||
const messages = flattenMessages((locales as any)[messageLanguage]);
|
const messages = flattenMessages((locales as any)[messageLanguage]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="bp3-dark">
|
|
||||||
<ErrorBoundary>
|
<ErrorBoundary>
|
||||||
<IntlProvider locale={language} messages={messages}>
|
<IntlProvider locale={language} messages={messages}>
|
||||||
<ToastProvider>
|
<ToastProvider>
|
||||||
@@ -38,7 +38,6 @@ export const App: React.FC = () => {
|
|||||||
<Switch>
|
<Switch>
|
||||||
<Route exact path="/" component={Stats} />
|
<Route exact path="/" component={Stats} />
|
||||||
<Route path="/scenes" component={Scenes} />
|
<Route path="/scenes" component={Scenes} />
|
||||||
{/* <Route path="/scenes/:id" component={Scene} /> */}
|
|
||||||
<Route path="/galleries" component={Galleries} />
|
<Route path="/galleries" component={Galleries} />
|
||||||
<Route path="/performers" component={Performers} />
|
<Route path="/performers" component={Performers} />
|
||||||
<Route path="/tags" component={TagList} />
|
<Route path="/tags" component={TagList} />
|
||||||
@@ -54,6 +53,5 @@ export const App: React.FC = () => {
|
|||||||
</ToastProvider>
|
</ToastProvider>
|
||||||
</IntlProvider>
|
</IntlProvider>
|
||||||
</ErrorBoundary>
|
</ErrorBoundary>
|
||||||
</div>
|
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import {
|
|||||||
FindStudiosQueryResult,
|
FindStudiosQueryResult,
|
||||||
FindPerformersQueryResult
|
FindPerformersQueryResult
|
||||||
} from "src/core/generated-graphql";
|
} 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 { LoadingIndicator } from "src/components/Shared";
|
||||||
import { ListFilter } from "src/components/List/ListFilter";
|
import { ListFilter } from "src/components/List/ListFilter";
|
||||||
import { Pagination } from "src/components/List/Pagination";
|
import { Pagination } from "src/components/List/Pagination";
|
||||||
@@ -134,14 +134,17 @@ const useList = <QueryResult extends IQueryResult, QueryData extends IDataItem>(
|
|||||||
setFilter(newFilter);
|
setFilter(newFilter);
|
||||||
|
|
||||||
if (forageInitialised.current) {
|
if (forageInitialised.current) {
|
||||||
setInterfaceForage(d => {
|
setInterfaceForage(config => {
|
||||||
const dataClone = _.cloneDeep(d);
|
const data = { ...config } as IInterfaceConfig;
|
||||||
dataClone!.queries[options.filterMode] = {
|
data.queries = {
|
||||||
|
...config?.queries,
|
||||||
|
[options.filterMode]: {
|
||||||
filter: location.search,
|
filter: location.search,
|
||||||
itemsPerPage: newFilter.itemsPerPage,
|
itemsPerPage: newFilter.itemsPerPage,
|
||||||
currentPage: newFilter.currentPage
|
currentPage: newFilter.currentPage
|
||||||
};
|
}
|
||||||
return dataClone;
|
}
|
||||||
|
return data;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}, [location, options.filterMode, options.subComponent, setInterfaceForage]);
|
}, [location, options.filterMode, options.subComponent, setInterfaceForage]);
|
||||||
|
|||||||
Reference in New Issue
Block a user