Skip to content

Open-source AI teammates in Slack, Teams, Discord, Telegram and Mattermost. Self-host it, with any agent harness and any model.

fix(gateway): cover every Popper, not only Autocompletes, against #185

Petr Bauchcda2707ab7c9
diff --git a/gateway/src/theme/theme.ts b/gateway/src/theme/theme.ts
index cdc73ea58..9911d2da2 100644
--- a/gateway/src/theme/theme.ts
+++ b/gateway/src/theme/theme.ts
@@ -75,14 +75,19 @@ const focusRing = {
/**
* Switches off the modifier MUI's Popper adds to copy popper.js's placement
* into React state. The Popper re-positions after every render, and that copy
- * then queues an update even when the placement has not changed. Typing into
- * an open Autocomplete faster than the browser yields to React's scheduler
- * (a paste-by-key tool, a scanner, fuzzed input) piles one up per keystroke,
- * and the 51st trips React's "Maximum update depth exceeded" (#185). popper.js
- * still positions the popup, and no Autocomplete reads the placement. A module
- * constant because the Popper rebuilds itself whenever `modifiers` changes.
+ * then queues an update even when the placement has not changed. Typing faster
+ * than the browser yields to React's scheduler (a paste-by-key tool, a
+ * scanner, fuzzed input) while a Popper is mounted, an Autocomplete's popup or
+ * a data grid's column menu, piles one up per keystroke, and the 51st trips
+ * React's "Maximum update depth exceeded" (#185). popper.js still positions
+ * the popup; only the placement a flip picks is no longer reported back.
+ *
+ * Given as `popperOptions` because the Popper appends those modifiers after
+ * the ones a component passes, as the data grid does. A Tooltip passes its own
+ * `popperOptions` and so keeps the report, which its arrow needs. A module
+ * constant because the Popper rebuilds itself whenever its options change.
*/
-const AUTOCOMPLETE_POPPER_MODIFIERS = [{ name: "onUpdate", enabled: false }];
+const POPPER_OPTIONS = { modifiers: [{ name: "onUpdate", enabled: false }] };
export const APP_THEME = () =>
createTheme({
@@ -132,9 +137,6 @@ export const APP_THEME = () =>
".tabular": { fontVariantNumeric: "tabular-nums" },
},
},
- MuiAutocomplete: {
- defaultProps: { slotProps: { popper: { modifiers: AUTOCOMPLETE_POPPER_MODIFIERS } } },
- },
MuiAccordion: {
styleOverrides: { root: { backgroundColor: "inherit", backgroundImage: "none" } },
},
@@ -296,6 +298,7 @@ export const APP_THEME = () =>
},
},
},
+ MuiPopper: { defaultProps: { popperOptions: POPPER_OPTIONS } },
MuiTextField: { defaultProps: { size: "small", fullWidth: true, variant: "outlined" } },
MuiTooltip: {
defaultProps: { arrow: true },