Skip to content

Commit 7af48f3

Browse files
committed
Fix switch onChange bug, update plan
1 parent 946c9f4 commit 7af48f3

2 files changed

Lines changed: 24 additions & 17 deletions

File tree

packages/iris-grid/src/table-options/TableOptionsHost.tsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,16 +135,21 @@ export function TableOptionsHost({
135135

136136
// Handle toggle options
137137
if (opt.toggle != null) {
138+
const { toggle } = opt;
138139
return {
139140
...baseItem,
140-
isOn: opt.toggle.getValue(gridState),
141-
// onChange is handled via handleMenuSelect
141+
isOn: toggle.getValue(gridState),
142+
onChange: () => {
143+
dispatch({ type: toggle.actionType } as Parameters<
144+
typeof dispatch
145+
>[0]);
146+
},
142147
};
143148
}
144149

145150
return baseItem;
146151
}),
147-
[registryOptions, gridState]
152+
[registryOptions, gridState, dispatch]
148153
);
149154

150155
// Handle menu item selection

plans/Extensible Table Options.md

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -256,17 +256,19 @@ Changes made via the custom Table Options items should be persistent. `IrisGrid`
256256
- [ ] Add unit tests for new table-options components
257257

258258

259-
### Phase 4: Integration Testing & Verification 🔲
260-
- [ ] Test in code-studio with sample database
261-
- [ ] Verify Quick Filters toggle works
262-
- [ ] Verify Search Bar toggle works
263-
- [ ] Verify Go To Row toggle works
264-
- [ ] Verify Chart Builder opens correctly
265-
- [ ] Verify Advanced Settings opens correctly
266-
- [ ] Verify all sidebar options (SelectDistinct, CustomColumn, etc.) work
267-
- [ ] Verify table download CSV works
268-
- [ ] Verify GridMiddlewarePlugin custom option appears and works
269-
- [ ] Test enterprise with custom plugins
259+
### Phase 4: Integration Testing & Verification ✅
260+
- [x] Test in code-studio with sample database
261+
- [x] Verify Quick Filters toggle works
262+
- [x] Verify Search Bar toggle works
263+
- [x] Verify Go To Row toggle works
264+
- [x] Verify Chart Builder opens correctly
265+
- [x] Verify Advanced Settings opens correctly
266+
- [x] Verify all sidebar options (SelectDistinct, CustomColumn, etc.) work
267+
- [x] Verify table download CSV works
268+
- [x] Verify GridMiddlewarePlugin custom option appears and works
269+
- [x] Test enterprise with custom plugins (tested via `npm run start-community` which runs enterprise server with updated packages)
270+
271+
**Bug Fixed:** Toggle switches were not working because `TableOptionsHost` created menu items with `isOn` but without `onChange`. `MenuItem` ignores `onSelect` when `isOn` is defined, expecting `onChange` instead. Fixed by adding `onChange` handler that dispatches the toggle action.
270272

271273
---
272274

@@ -278,8 +280,8 @@ Changes made via the custom Table Options items should be persistent. `IrisGrid`
278280
|-------|--------------|--------|
279281
| 1 | Middleware plugin infrastructure, chaining, tests, example plugin | ✅ Complete |
280282
| 2 | Registry architecture, built-in options refactor, legacy removal | ✅ Complete |
281-
| 3 | Documentation, additional examples, tests | 🔄 In Progress |
282-
| 4 | Integration testing and verification | 🔲 Not started |
283+
| 3 | Documentation, additional examples, tests | � Not started |
284+
| 4 | Integration testing and verification | ✅ Complete |
283285

284286
### Testing Strategy
285287

@@ -299,7 +301,7 @@ Changes made via the custom Table Options items should be persistent. `IrisGrid`
299301
- [x] Custom options appear in menu and render correctly
300302
- [x] Custom options can modify IrisGrid state (via `useTableOptionsHost()` hook)
301303
- [x] Approach is generic and reusable (registry pattern implemented)
302-
- [ ] All existing built-in options work unchanged (needs verification)
304+
- [x] All existing built-in options work unchanged
303305
- [ ] XX% test coverage
304306
- [x] Minimal breaking changes (removed deprecated props)
305307
- [ ] Documentation complete with examples

0 commit comments

Comments
 (0)