mirror of
https://github.com/morpheus65535/bazarr
synced 2025-01-01 04:26:13 +00:00
no log: Rename fetched to dirty in OrderIdState
This commit is contained in:
parent
b912ca4e41
commit
dffb417413
4 changed files with 10 additions and 10 deletions
|
@ -4,7 +4,7 @@ export function defaultAOS(): AsyncOrderState<any> {
|
|||
data: {
|
||||
items: [],
|
||||
order: [],
|
||||
fetched: false,
|
||||
dirty: false,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ export function updateOrderIdState<T extends LooseObject>(
|
|||
return {
|
||||
data: {
|
||||
...state.data,
|
||||
fetched: true,
|
||||
dirty: true,
|
||||
},
|
||||
updating: true,
|
||||
};
|
||||
|
@ -44,7 +44,7 @@ export function updateOrderIdState<T extends LooseObject>(
|
|||
return {
|
||||
data: {
|
||||
...state.data,
|
||||
fetched: true,
|
||||
dirty: true,
|
||||
},
|
||||
updating: false,
|
||||
error: action.payload.item as Error,
|
||||
|
@ -107,7 +107,7 @@ export function updateOrderIdState<T extends LooseObject>(
|
|||
return {
|
||||
updating: false,
|
||||
data: {
|
||||
fetched: true,
|
||||
dirty: true,
|
||||
items: newItems,
|
||||
order: newOrder,
|
||||
},
|
||||
|
@ -131,7 +131,7 @@ export function deleteOrderListItemBy<T extends LooseObject>(
|
|||
return {
|
||||
...state,
|
||||
data: {
|
||||
fetched: true,
|
||||
dirty: true,
|
||||
items: newItems,
|
||||
order: newOrder,
|
||||
},
|
||||
|
|
2
frontend/src/@types/basic.d.ts
vendored
2
frontend/src/@types/basic.d.ts
vendored
|
@ -14,7 +14,7 @@ type StorageType = string | null;
|
|||
interface OrderIdState<T> {
|
||||
items: IdState<T>;
|
||||
order: (number | null)[];
|
||||
fetched: boolean;
|
||||
dirty: boolean;
|
||||
}
|
||||
|
||||
interface AsyncState<T> {
|
||||
|
|
|
@ -21,7 +21,7 @@ export default function AsyncPageTable<T extends object>(props: Props<T>) {
|
|||
|
||||
const {
|
||||
updating,
|
||||
data: { order, items, fetched },
|
||||
data: { order, items, dirty },
|
||||
} = aos;
|
||||
|
||||
const allPlugins: PluginHook<T>[] = [useDefaultSettings];
|
||||
|
@ -85,12 +85,12 @@ export default function AsyncPageTable<T extends object>(props: Props<T>) {
|
|||
}, [pageIndex]);
|
||||
|
||||
useEffect(() => {
|
||||
const needInit = visibleItemIds.length === 0 && fetched === false;
|
||||
const needFetch = visibleItemIds.length === 0 && dirty === false;
|
||||
const needRefresh = !visibleItemIds.every(isNonNullable);
|
||||
if (needInit || needRefresh) {
|
||||
if (needFetch || needRefresh) {
|
||||
loader(pageStart, pageSize);
|
||||
}
|
||||
}, [visibleItemIds, pageStart, pageSize, loader, fetched]);
|
||||
}, [visibleItemIds, pageStart, pageSize, loader, dirty]);
|
||||
|
||||
const showLoading = useMemo(
|
||||
() =>
|
||||
|
|
Loading…
Reference in a new issue