Skip to content

Commit ba3b764

Browse files
committed
fix(gallery): register JS action event listeners for Reset Filters and Clear Selection
Gallery widget has all infrastructure for external JS actions support but never registered event listeners, causing "Reset All Filters" and "Clear Selection" actions to fire into the void. This change: - Creates useGalleryJSActions() helper to register event listeners - Integrates hook into GalleryWidget component - Mirrors datagrid's working implementation pattern Infrastructure already existed: - @mendix/widget-plugin-external-events dependency - Config with name and filtersChannelName - SelectActionsProvider with clearSelection() method - Filter system with CombinedFilter The fix is minimal - just wires up the listeners. Jira: WC-3462
1 parent 93b4fb9 commit ba3b764

3 files changed

Lines changed: 19 additions & 0 deletions

File tree

packages/pluggableWidgets/gallery-web/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66

77
## [Unreleased]
88

9+
### Fixed
10+
11+
- We fixed an issue where "Reset All Filters" and "Clear Selection" JavaScript actions did not work with the Gallery widget. Event listeners were not registered despite the required infrastructure being in place.
12+
913
## [3.11.0] - 2026-05-27
1014

1115
### Added

packages/pluggableWidgets/gallery-web/src/components/GalleryWidget.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,10 @@ import { GalleryRoot as Root } from "./GalleryRoot";
99
import { GalleryTopBar as TopBar } from "./GalleryTopBar";
1010
import { GalleryTopBarControls as TopBarControls } from "./GalleryTopBarControls";
1111
import { RefreshStatus } from "./RefreshStatus";
12+
import { useGalleryJSActions } from "../helpers/useGalleryJSActions";
1213

1314
export function GalleryWidget(): ReactElement {
15+
useGalleryJSActions();
1416
return (
1517
<Root>
1618
<TopBar>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { useOnClearSelectionEvent, useOnResetFiltersEvent } from "@mendix/widget-plugin-external-events/hooks";
2+
import { useGalleryConfig, useSelectActions } from "../model/hooks/injection-hooks";
3+
4+
export function useGalleryJSActions(): void {
5+
const config = useGalleryConfig();
6+
const selectActions = useSelectActions();
7+
8+
useOnResetFiltersEvent(config.name, config.filtersChannelName);
9+
useOnClearSelectionEvent({
10+
widgetName: config.name,
11+
listener: () => selectActions.clearSelection()
12+
});
13+
}

0 commit comments

Comments
 (0)