Skip to content

fix(WEBVIEW-002): CU-17tkuw60edv parallax-image-showcase stores the raw DOMRect in state on every resize/scroll - #2626

Closed
flamingo[bot] wants to merge 1 commit into
mainfrom
ai-fix/webview-002-8d11c756-c40b7363
Closed

flamingo[bot] wants to merge 1 commit into
mainfrom
ai-fix/webview-002-8d11c756-c40b7363

Conversation

@flamingo

@flamingo flamingo Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Closes findings from rule WEBVIEW-002 — parallax-image-showcase stores the raw DOMRect in state on every resize/scroll.

Draft — this is a starting point, not a finished change. The fix required judgment, so read it before trusting it.

# Fix confidence Finding Location
1 🟢 90 high parallax-image-showcase stores the raw DOMRect in state on every resize/scroll openframe-frontend-core/src/components/features/parallax-image-showcase.tsx:46

What changed — and what was deliberately left — is explained per finding as inline review comments on the lines each finding touched.


Run: https://product-hub.flamingo.so/admin/code-review
Run id: c40b7363-145c-433c-a3bc-3b4b3af00901

Merging this PR is recorded as acceptance of the rule that produced it;
closing it unmerged is recorded as rejection. Both feed rule health, so
closing a wrong suggestion is useful rather than merely tidy.

ClickUp task: CU-17tkuw60edv DOMRect state churn in parallax component (1 PRs)

@flamingo flamingo Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

🦩 What this fix changed, finding by finding

1 finding(s) fixed in this draft — 1 explained inline on the diff.

const mouseYSpring = useSpring(mouseY, springConfig);

// Track component position for global mouse calculations
const [componentRect, setComponentRect] = useState<DOMRect | null>(null);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

🦩 🔵 parallax-image-showcase stores the raw DOMRect in state on every resize/scroll

In ParallaxImageShowcase, replaced const [componentRect, setComponentRect] = useState<DOMRect | null>(null) with const componentRectRef = useRef<DOMRect | null>(null). The updateRect resize/scroll handler in the first useEffect now assigns componentRectRef.current = ... instead of calling setComponentRect, so resize/scroll no longer trigger a re-render. The mousemove handler in the second useEffect now reads componentRectRef.current instead of the componentRect state, and that effect's dependency array was updated from [componentRect, mouseX, mouseY] to [mouseX, mouseY] since the ref no longer needs to be a reactive dependency. Removed the now-unused useState import. The derived values actually rendered from (mouseX/mouseY motion values, scroll/mouse transforms) are untouched and continue to drive framer-motion via refs/motion values rather than React state.

🤖 Prompt for AI agents
In openframe-frontend-core/src/components/features/parallax-image-showcase.tsx around line 46, review and complete this code-review fix: parallax-image-showcase stores the raw DOMRect in state on every resize/scroll.
What the draft fix changed: In `ParallaxImageShowcase`, replaced `const [componentRect, setComponentRect] = useState<DOMRect | null>(null)` with `const componentRectRef = useRef<DOMRect | null>(null)`. The `updateRect` resize/scroll handler in the first `useEffect` now assigns `componentRectRef.current = ...` instead of calling `setComponentRect`, so resize/scroll no longer trigger a re-render. The mousemove handler in the second `useEffect` now reads `componentRectRef.current` instead of the `componentRect` state, and that effect's dependency array was updated from `[componentRect, mouseX, mouseY]` to `[mouseX, mouseY]` since the ref no longer needs to be a reactive dependency. Removed the now-unused `useState` import. The derived values actually rendered from (mouseX/mouseY motion values, scroll/mouse transforms) are untouched and continue to drive framer-motion via refs/motion values rather than React state.
Verify the change is correct and complete; do not refactor unrelated code.

fix confidence: 🟢 90 high — react 👍/👎 to teach the reviewer

@flamingo flamingo Bot changed the title fix(WEBVIEW-002): parallax-image-showcase stores the raw DOMRect in state on every resize/scroll fix(WEBVIEW-002): CU-17tkuw5wzch parallax-image-showcase stores the raw DOMRect in state on every resize/scroll Oct 13, 2026
@flamingo flamingo Bot changed the title fix(WEBVIEW-002): CU-17tkuw5wzch parallax-image-showcase stores the raw DOMRect in state on every resize/scroll fix(WEBVIEW-002): CU-17tkuw60edv parallax-image-showcase stores the raw DOMRect in state on every resize/scroll Oct 24, 2026
@aliaska-varieva
aliaska-varieva deleted the ai-fix/webview-002-8d11c756-c40b7363 branch November 9, 2026 01:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant