Repository navigation
fix: improve field signing - #2830
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
2 Skipped Deployments
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (1)
💤 Files with no reviewable changes (1)
📝 WalkthroughWalkthroughEnvelope signing component syncs fullName/email/signature into refs for Konva handlers, modernizes multiple field click handlers, refactors signature auth/update flow, caches rendered fields with conditional re-renders and hit-detection rules, and disables event listening on specific Konva nodes. ChangesKonva Event Handling and Field Rendering
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Suggested reviewers
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Thank you for following the naming conventions for pull request titles! 💚🚀 |
There was a problem hiding this comment.
Pull request overview
Fixes several UX issues in the envelope signing flow: overflowing field text intercepts pointer events on neighboring fields, signature spinner not displaying due to a fire-and-forget auth procedure, and concurrent signing wiping out in-progress spinners because every field on the page was re-rendered on every state change.
Changes:
- Mark text/image/spinner Konva nodes (and other-recipient field groups) as non-listening so they don't intercept clicks meant for adjacent fields.
- In the signature click handler, await
executeActionAuthProcedureso the spinner remains visible until auth + signing complete (and usevoidto silence floating-promise lint). - Cache rendered fields by
inserted/customTextand switch state values (fullName/email/signature) to refs so unrelated state changes don't re-render every field (which was destroying spinners attached to in-flight signing operations).
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| apps/remix/app/components/general/envelope-signing/envelope-signer-page-renderer.tsx | Refs for signing state, per-field render cache, await auth procedure for spinner visibility, disable listening on other-recipient fields. |
| packages/lib/universal/field-renderer/render-signature-field.ts | Set listening: false on signature image and label text nodes. |
| packages/lib/universal/field-renderer/render-generic-text-field.ts | Set listening: false on the field text node. |
| packages/lib/universal/field-renderer/render-dropdown-field.ts | Set listening: false on dropdown selected-text and arrow nodes. |
| packages/lib/universal/field-renderer/field-generic-items.ts | Set listening: false on the loading spinner group. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
apps/remix/app/components/general/envelope-signing/envelope-signer-page-renderer.tsx (2)
448-474: 🧹 Nitpick | 🔵 Trivial | ⚡ Quick winCache or guard the other-recipient render loop too.
renderFields()now skips unchanged active-recipient fields, but this branch still re-renders every display-only field on every local sign/update. On pages with many completed fields, that keeps the read-only Konva work on the hot path. Guard these groups withfindOne()or a second cache before callingrenderField().🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/remix/app/components/general/envelope-signing/envelope-signer-page-renderer.tsx` around lines 448 - 474, The loop over localPageOtherRecipientFields re-renders every other-recipient field each update; add a cache or guard using Konva group lookup (e.g., pageLayer.current.findOne()) before calling renderField to skip creating a new group for fields that already exist. Specifically, in the block iterating localPageOtherRecipientFields, check for an existing rendered node by a stable selector (renderId or field.id) via pageLayer.current.findOne(...) or maintain a simple Map cache keyed by field.id; if found, update only hit-detection (call listening(false) on the existing group) and continue, otherwise call renderField(...) and then set listening(false) on the newly created fieldGroup and store it in the cache.
222-231:⚠️ Potential issue | 🟠 Major | ⚡ Quick winAdd
.catch()to handle rejections fromsignField()in these promise chains.
signField()rethrows after showing the error toast (line 497), so these discarded promise chains without a terminal.catch()will surface unhandled rejections. The.finally()alone does not suppress the rejection.Update all async branches in this
matchto include.catch(() => undefined)before.finally(). Also note the DROPDOWN field (lines 345–372) callsdestroy()both inside.then()and in.finally()—verify this double cleanup is intentional.Applies to: 222–231, 249–254, 260–269, 275–284, 290–303, 311–320, 326–339, 345–372, 375–407
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/remix/app/components/general/envelope-signing/envelope-signer-page-renderer.tsx` around lines 222 - 231, The promise chains that call async handlers like handleCheckboxFieldClick(...) then call signField(field.id, payload) currently end with .finally() but no .catch(), which allows rethrown errors from signField() to become unhandled rejections; update each chain (e.g. the chain starting at handleCheckboxFieldClick(...) that adds/loadingSpinnerGroup and calls signField) to insert a terminal .catch(() => undefined) before .finally() so rejections are swallowed after signField already handled UI toasts. Do the same for every branch mentioned (the chains handling DROPDOWN and other field types between lines noted) and while updating the DROPDOWN branch verify/remove the duplicate cleanup so loadingSpinnerGroup.destroy()/any group.destroy() is only called once (avoid destroying the same group both inside .then() and again in .finally()).
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In
`@apps/remix/app/components/general/envelope-signing/envelope-signer-page-renderer.tsx`:
- Around line 448-474: The loop over localPageOtherRecipientFields re-renders
every other-recipient field each update; add a cache or guard using Konva group
lookup (e.g., pageLayer.current.findOne()) before calling renderField to skip
creating a new group for fields that already exist. Specifically, in the block
iterating localPageOtherRecipientFields, check for an existing rendered node by
a stable selector (renderId or field.id) via pageLayer.current.findOne(...) or
maintain a simple Map cache keyed by field.id; if found, update only
hit-detection (call listening(false) on the existing group) and continue,
otherwise call renderField(...) and then set listening(false) on the newly
created fieldGroup and store it in the cache.
- Around line 222-231: The promise chains that call async handlers like
handleCheckboxFieldClick(...) then call signField(field.id, payload) currently
end with .finally() but no .catch(), which allows rethrown errors from
signField() to become unhandled rejections; update each chain (e.g. the chain
starting at handleCheckboxFieldClick(...) that adds/loadingSpinnerGroup and
calls signField) to insert a terminal .catch(() => undefined) before .finally()
so rejections are swallowed after signField already handled UI toasts. Do the
same for every branch mentioned (the chains handling DROPDOWN and other field
types between lines noted) and while updating the DROPDOWN branch verify/remove
the duplicate cleanup so loadingSpinnerGroup.destroy()/any group.destroy() is
only called once (avoid destroying the same group both inside .then() and again
in .finally()).
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: e3bfdef0-3587-4663-aa17-619a6302834c
📒 Files selected for processing (5)
apps/remix/app/components/general/envelope-signing/envelope-signer-page-renderer.tsxpackages/lib/universal/field-renderer/field-generic-items.tspackages/lib/universal/field-renderer/render-dropdown-field.tspackages/lib/universal/field-renderer/render-generic-text-field.tspackages/lib/universal/field-renderer/render-signature-field.ts
Description
Resolves some issues to make the signing process smoother:
Signature Fields
Before
signatures-before.mov
After
signatures-after.mov
Text Fields
Before
before-normal-fields.mov
After
sig-final.mov