fix(gui): clear loading state for image when it enters history
This commit is contained in:
parent
732aa27b92
commit
7181d62fba
|
@ -62,7 +62,7 @@ export function LoadingCard(props: LoadingCardProps) {
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (cancel.status === 'success') {
|
if (cancel.status === 'success') {
|
||||||
clearLoading();
|
clearLoading(props.loading);
|
||||||
}
|
}
|
||||||
}, [cancel.status]);
|
}, [cancel.status]);
|
||||||
|
|
||||||
|
|
|
@ -46,12 +46,14 @@ interface HistorySlice {
|
||||||
limit: number;
|
limit: number;
|
||||||
loading: Array<LoadingItem>;
|
loading: Array<LoadingItem>;
|
||||||
|
|
||||||
// TODO: hack until setLoading removes things
|
clearLoading(image: ImageResponse): void;
|
||||||
clearLoading(): void;
|
|
||||||
pushHistory(image: ImageResponse): void;
|
pushHistory(image: ImageResponse): void;
|
||||||
pushLoading(image: ImageResponse): void;
|
pushLoading(image: ImageResponse): void;
|
||||||
removeHistory(image: ImageResponse): void;
|
removeHistory(image: ImageResponse): void;
|
||||||
setLimit(limit: number): void;
|
setLimit(limit: number): void;
|
||||||
|
/**
|
||||||
|
* @todo should check ready and move the image from loading to history
|
||||||
|
*/
|
||||||
setReady(image: ImageResponse, ready: ReadyResponse): void;
|
setReady(image: ImageResponse, ready: ReadyResponse): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -274,10 +276,10 @@ export function createStateSlices(server: ServerParams) {
|
||||||
history: [],
|
history: [],
|
||||||
limit: DEFAULT_HISTORY.limit,
|
limit: DEFAULT_HISTORY.limit,
|
||||||
loading: [],
|
loading: [],
|
||||||
clearLoading() {
|
clearLoading(image) {
|
||||||
set((prev) => ({
|
set((prev) => ({
|
||||||
...prev,
|
...prev,
|
||||||
loading: [],
|
loading: prev.loading.filter((it) => it.image.output.key !== image.output.key),
|
||||||
}));
|
}));
|
||||||
},
|
},
|
||||||
pushHistory(image) {
|
pushHistory(image) {
|
||||||
|
@ -287,7 +289,7 @@ export function createStateSlices(server: ServerParams) {
|
||||||
image,
|
image,
|
||||||
...prev.history,
|
...prev.history,
|
||||||
].slice(0, prev.limit + DEFAULT_HISTORY.scrollback),
|
].slice(0, prev.limit + DEFAULT_HISTORY.scrollback),
|
||||||
loading: [],
|
loading: prev.loading.filter((it) => it.image.output.key !== image.output.key),
|
||||||
}));
|
}));
|
||||||
},
|
},
|
||||||
pushLoading(image) {
|
pushLoading(image) {
|
||||||
|
|
Loading…
Reference in New Issue