Skip to content

Commit 8574dd9

Browse files
committed
fix: reload data after status becomes available. it will make sure no item is disabled anymore
1 parent 1c196a0 commit 8574dd9

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

  • packages/pluggableWidgets/gallery-native/src

packages/pluggableWidgets/gallery-native/src/Gallery.tsx

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import { extractFilters } from "./utils/filters";
1313
import { FilterCondition } from "mendix/filters";
1414
import { Gallery as GalleryComponent, GalleryProps as GalleryComponentProps } from "./components/Gallery";
1515
import { GalleryProps } from "../typings/GalleryProps";
16-
import { ObjectItem } from "mendix";
16+
import { ObjectItem, ValueStatus } from "mendix";
1717

1818
export const Gallery = (props: GalleryProps<GalleryStyle>): ReactElement => {
1919
const viewStateFilters = useRef<FilterCondition | undefined>(undefined);
@@ -29,6 +29,18 @@ export const Gallery = (props: GalleryProps<GalleryStyle>): ReactElement => {
2929
}
3030
}, [props.datasource, props.pageSize]);
3131

32+
useEffect(() => {
33+
if (props.datasource.status === ValueStatus.Available) {
34+
return;
35+
}
36+
const intervalId = setInterval(() => {
37+
props.datasource.reload();
38+
if (props.datasource.status === ValueStatus.Available) {
39+
clearInterval(intervalId); // Break the interval
40+
}
41+
}, 1000);
42+
}, [props.datasource.items]);
43+
3244
useEffect(() => {
3345
if (props.datasource.filter && !filtered && !viewStateFilters.current) {
3446
viewStateFilters.current = props.datasource.filter;

0 commit comments

Comments
 (0)