Compare commits

...

2 Commits

Author SHA1 Message Date
seer-by-sentry[bot]
278db55cea perf(frontend): Debounce scrollbar detection in DialogWrap 2025-12-19 16:46:41 +00:00
Ubbe
4a7bc006a8 hotfix(frontend): chat should be disabled by default (#11639)
### Changes 🏗️

Chat should be disabled by default; otherwise, it flashes, and if Launch
Darkly fails to fail, it is dangerous.

### Checklist 📋

#### For code changes:
- [x] I have clearly listed my changes in the PR description
- [x] I have made a test plan
- [x] I have tested my changes according to the test plan:
  - [x] Run locally with Launch Darkly disabled and test the above
2025-12-18 19:04:13 +01:00
2 changed files with 13 additions and 4 deletions

View File

@@ -3,6 +3,7 @@ import { scrollbarStyles } from "@/components/styles/scrollbars";
import { cn } from "@/lib/utils";
import { X } from "@phosphor-icons/react";
import * as RXDialog from "@radix-ui/react-dialog";
import { debounce } from "lodash";
import {
CSSProperties,
PropsWithChildren,
@@ -70,13 +71,21 @@ export function DialogWrap({
if (!el) return;
setHasVerticalScrollbar(el.scrollHeight > el.clientHeight + 1);
}
// Debounce the update function to prevent rapid successive state updates
const debouncedUpdate = debounce(update, 100);
// Initial update without debounce for immediate UI feedback
update();
const ro = new ResizeObserver(update);
const ro = new ResizeObserver(debouncedUpdate);
if (scrollRef.current) ro.observe(scrollRef.current);
window.addEventListener("resize", update);
window.addEventListener("resize", debouncedUpdate);
return () => {
debouncedUpdate.cancel();
ro.disconnect();
window.removeEventListener("resize", update);
window.removeEventListener("resize", debouncedUpdate);
};
}, []);

View File

@@ -48,7 +48,7 @@ const mockFlags = {
[Flag.AGENT_FAVORITING]: false,
[Flag.MARKETPLACE_SEARCH_TERMS]: DEFAULT_SEARCH_TERMS,
[Flag.ENABLE_PLATFORM_PAYMENT]: false,
[Flag.CHAT]: true,
[Flag.CHAT]: false,
};
export function useGetFlag<T extends Flag>(flag: T): FlagValues[T] | null {