Skip to content

Commit cb294f7

Browse files
authored
[MOO-2218]: Fix gallery-native load and render (#429)
2 parents ef4bece + 94f244a commit cb294f7

4 files changed

Lines changed: 14 additions & 5 deletions

File tree

packages/pluggableWidgets/gallery-native/CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,15 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66

77
## [Unreleased]
88

9+
### Fixed
10+
11+
- We've fixed an issue with a race condition where the Gallery widget would not consistently render items when using virtual scrolling in arbitrary scenarios.
12+
913
## [2.0.1] - 2025-10-17
1014

1115
### Fixed
1216

13-
- We've fixed an issue where the Gallery widget would not properly load more items when scrolling down quickly.
17+
- We've fixed an issue where the Gallery widget would not properly load more items when scrolling down quickly.
1418

1519
## [2.0.0] - 2024-12-3
1620

packages/pluggableWidgets/gallery-native/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "gallery-native",
33
"widgetName": "Gallery",
4-
"version": "2.0.1",
4+
"version": "2.0.2",
55
"description": "A flexible gallery widget that renders columns, rows and layouts.",
66
"copyright": "© Mendix Technology BV 2022. All rights reserved.",
77
"license": "Apache-2.0",

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { all } from "deepmerge";
2-
import { createElement, ReactElement, useCallback, useEffect, useMemo, useState, useRef } from "react";
2+
import { createElement, ReactElement, useCallback, useEffect, useMemo, useState, useRef, Fragment } from "react";
33
import {
44
executeAction,
55
FilterType,
@@ -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);
@@ -49,6 +49,7 @@ export const Gallery = (props: GalleryProps<GalleryStyle>): ReactElement => {
4949
}),
5050
{}
5151
),
52+
// eslint-disable-next-line react-hooks/exhaustive-deps
5253
[props.filterList, viewStateFilters.current]
5354
);
5455

@@ -103,6 +104,10 @@ export const Gallery = (props: GalleryProps<GalleryStyle>): ReactElement => {
103104
[FilterContext, customFiltersState, filterList, initialFilters, isFilterable, props.filtersPlaceholder]
104105
);
105106

107+
if (props.datasource.status === ValueStatus.Loading && props.datasource.items === undefined) {
108+
return <Fragment />;
109+
}
110+
106111
return (
107112
<GalleryComponent
108113
emptyPlaceholder={props.emptyPlaceholder}

packages/pluggableWidgets/gallery-native/src/package.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8" ?>
22
<package xmlns="http://www.mendix.com/package/1.0/">
3-
<clientModule name="Gallery" version="2.0.1" xmlns="http://www.mendix.com/clientModule/1.0/">
3+
<clientModule name="Gallery" version="2.0.2" xmlns="http://www.mendix.com/clientModule/1.0/">
44
<widgetFiles>
55
<widgetFile path="Gallery.xml" />
66
</widgetFiles>

0 commit comments

Comments
 (0)