-
Notifications
You must be signed in to change notification settings - Fork 120
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Problem
In save-template-overlay.tsx, the matchedTemplate useMemo reads sourceRef.current to find the source template from the apply flow. However, React refs don't trigger re-renders when they change, so the memo's dependency array ([html, agent.state?.templates]) won't capture changes to sourceRef.current.
In practice this works because html or templates changes trigger recomputation, but it's technically not guaranteed — if the ref is set after the last html/templates change, the matched template badge could show stale data.
Suggested fix
Either:
- Store the source template info in state instead of a ref (triggers re-render on change)
- Add the source ID as an explicit dependency by extracting it to a state variable
Files
apps/app/src/components/generative-ui/save-template-overlay.tsx
From PR #20 review
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working