Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions src/components/HomeClient.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,7 @@ export default function HomeClient({ content }: HomeClientProps) {
);
const [dockKeysVisible, setDockKeysVisible] = useState(true);
const dockKeysVisibleRef = useRef(true);
const [virtualKeysOpen, setVirtualKeysOpen] = useState(false);
const scrollProgressRef = useSmoothScrollProgress(heroRef, (value) => {
if (!shellRef.current) {
return;
Expand Down Expand Up @@ -462,6 +463,10 @@ export default function HomeClient({ content }: HomeClientProps) {
if (dockKeysVisibleRef.current !== nextDockKeysVisible) {
dockKeysVisibleRef.current = nextDockKeysVisible;
setDockKeysVisible(nextDockKeysVisible);
// Close virtual keys when dock becomes hidden
if (!nextDockKeysVisible) {
setVirtualKeysOpen(false);
}
}
});
const isMobile = useMediaQuery("(max-width: 900px)");
Expand Down Expand Up @@ -501,7 +506,6 @@ export default function HomeClient({ content }: HomeClientProps) {
shift: false,
alt: false,
});
const [virtualKeysOpen, setVirtualKeysOpen] = useState(false);
const mobileModifiersRef = useRef(mobileModifiers);
const handleSceneReady = useCallback(() => {
setSceneReady(true);
Expand Down Expand Up @@ -656,12 +660,6 @@ export default function HomeClient({ content }: HomeClientProps) {
mobileModifiersRef.current = mobileModifiers;
}, [mobileModifiers]);

useEffect(() => {
if (!dockKeysVisible && virtualKeysOpen) {
setVirtualKeysOpen(false);
}
}, [dockKeysVisible, virtualKeysOpen]);

useEffect(() => {
screenAspectRef.current = screenAspect;
}, [screenAspect]);
Expand Down
5 changes: 1 addition & 4 deletions src/components/hero/HeroScene.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,6 @@ function ComputerModel({
onScreenMeshAction,
onCameraRig,
onContentReady,
isMobile,
usePhoneRig,
shadowsEnabled,
allowTerminalTexture,
Expand All @@ -307,7 +306,6 @@ function ComputerModel({
onScreenMeshAction?: (mesh: Mesh | null) => void;
onCameraRig?: (rig: CameraRig) => void;
onContentReady?: () => void;
isMobile: boolean;
usePhoneRig: boolean;
shadowsEnabled: boolean;
allowTerminalTexture: boolean;
Expand Down Expand Up @@ -788,6 +786,7 @@ function ComputerModel({
scene,
setPlaneColor,
usePhoneRig,
shadowsEnabled,
Copy link

Copilot AI Jan 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shadowsEnabled was added to this useLayoutEffect dependency list, but the effect does a full scene.traverse(...) and also calls onDebugAction(...) every time it runs. Since shadowsEnabled toggles with interactionActive/enhancedLighting, this can cause repeated expensive traversals and repeated debug callbacks (in HomeClient, onDebugAction updates modelReadyAt, which can delay the boot timing). Consider removing all shadowsEnabled usage from this layout effect (it’s only used to set castShadow/receiveShadow) and rely on the existing useEffect([scene, shadowsEnabled]) below to apply shadow flags, so shadow toggles don’t retrigger the heavy layout pass.

Suggested change
shadowsEnabled,

Copilot uses AI. Check for mistakes.
]);

useEffect(() => {
Expand Down Expand Up @@ -1113,7 +1112,6 @@ function SceneContent({
scrollProgressRef,
noteTexts,
onDebugAction,
onFocusAction,
onScreenAspectAction,
onReadyAction,
interactionActive,
Expand Down Expand Up @@ -1627,7 +1625,6 @@ function SceneContent({
onScreenMeshAction={handleScreenMesh}
onCameraRig={handleCameraRig}
onContentReady={handleContentReady}
isMobile={isMobile}
usePhoneRig={usePhoneRig}
shadowsEnabled={shadowsEnabled}
allowTerminalTexture={true}
Expand Down
Loading