Conversation
Greptile SummaryThis PR fixes the Confidence Score: 4/5Safe to merge; the only finding is a minor test robustness gap that does not affect production behaviour. No P0 or P1 issues found. The implementation is correct and idempotent. Score is 4 due to a single P2 (test sentinel value not asserted, leaving a small coverage gap in the new regression test). packages/framer-motion/src/motion/utils/tests/use-motion-ref.test.tsx — sentinel assertion gap in the new test case. Important Files Changed
Sequence DiagramsequenceDiagram
participant React
participant useMotionRef
participant VisualElement
participant visualElementStore
participant ExternalRef
React->>useMotionRef: ref callback(instance)
useMotionRef->>VisualElement: register(instance)
VisualElement->>VisualElement: this.current = instance
VisualElement->>visualElementStore: set(instance, this)
useMotionRef->>ExternalRef: externalRef(instance)
Note over ExternalRef,visualElementStore: Consumer can now resolve VisualElement via visualElementStore.get(instance)
useMotionRef->>VisualElement: mount(instance)
VisualElement->>VisualElement: register(instance) [idempotent]
VisualElement->>VisualElement: bindToMotionValue, update, etc.
Reviews (1): Last reviewed commit: "Latest" | Re-trigger Greptile |
| expect(lookedUpVisualElement).toBeDefined() | ||
| expect(lookedUpVisualElement).not.toBeNull() |
There was a problem hiding this comment.
Sentinel value never asserted — ref callback could silently skip
lookedUpVisualElement is initialised to "not-set", but the test never asserts that it changed from that sentinel. If refCallback were never invoked (e.g., a render regression, wrong instance guard), lookedUpVisualElement would remain "not-set", which is both defined and non-null, so both existing assertions would still pass. Adding expect(lookedUpVisualElement).not.toBe("not-set") would confirm the callback actually fired.
| expect(lookedUpVisualElement).toBeDefined() | |
| expect(lookedUpVisualElement).not.toBeNull() | |
| expect(lookedUpVisualElement).not.toBe("not-set") | |
| expect(lookedUpVisualElement).toBeDefined() | |
| expect(lookedUpVisualElement).not.toBeNull() |
No description provided.