fix: Waves tab icon alignment + draft caret follow-ups#3309
Conversation
…ite on unmount Review follow-ups to the draft-caret feature: - When no caret is saved (legacy draft, cross-device draft, first open after this shipped), restore to the end of the body instead of position 0. Keeps the feature purely additive and avoids dropping the auto-focused cursor at the top (where immediate typing would prepend to the post). - Cancel the debounced caret persister on unmount so a late write can't re-create a caretMap entry that publish/first-save just cleared.
react-native-svg's <Svg> ignored the shared paddingTop the vector-font tab icons honor on their <Text>, so the Waves icon sat ~15px too high. Apply the layout style (the tab bar's top offset) to a wrapping <View> instead, which honors padding; the parent tab cell centers it horizontally. Keeps the same footprint as the other icons across phones and tablets on iOS and Android.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe wavy dash icon now applies styling through a wrapping ChangesWavy dash icon layout
Markdown editor caret handling
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ 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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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.
Inline comments:
In `@src/components/markdownEditor/view/markdownEditorView.tsx`:
- Around line 249-252: The unmount cleanup in markdownEditorView still only
cancels _persistCaret, so _debouncedOnTextChange can run after unmount and
trigger stale body writes and setIsEditing(false). Update the existing useEffect
cleanup near _persistCaret to also cancel _debouncedOnTextChange, using the same
unmount teardown path in markdownEditorView. Keep the fix localized to the
editor lifecycle cleanup so both debounced callbacks are stopped before any
publish/first-save state is cleared.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: c43102b1-96c0-4a77-a9bf-4b182beb3b55
📒 Files selected for processing (2)
src/assets/svgs/wavy-dash-icon.tsxsrc/components/markdownEditor/view/markdownEditorView.tsx
Greptile SummaryThis PR updates Waves tab rendering and draft caret persistence. The main changes are:
Confidence Score: 5/5This looks safe to merge.
Important Files Changed
Reviews (2): Last reviewed commit: "fix(editor): flush (not cancel) pending ..." | Re-trigger Greptile |
…ount Review follow-up: cancelling _persistCaret on unmount dropped the caret when the user moved the cursor and left within the 600ms window (stale caret on reopen), and the body debounce (_debouncedOnTextChange) could still fire after unmount. Flush both on unmount so the latest caret and body are committed synchronously before teardown, addressing both the dropped-caret and late-body-write windows.
|
Both review comments point at the same unmount cleanup, and they pull in opposite directions:
Resolved both with useEffect(
() => () => {
_persistCaret.flush();
_debouncedOnTextChange.flush();
},
[_persistCaret, _debouncedOnTextChange],
);Flushing commits the pending caret and body synchronously during the unmount cleanup (which runs before the parent's unmount save), so:
The only residual is a harmless, rare orphan |
Follow-ups to #3308 (already merged).
Waves tab icon alignment
The wavy-dash Waves icon sat ~15px higher than the other bottom-tab icons. Cause:
react-native-svg's<Svg>ignores the sharedpaddingTopthat the vector-font icons honor on their<Text>. Fix: apply that layout offset to a wrapping<View>(which honors padding) and let the parent tab cell center it horizontally, so the icon keeps the same footprint as the others across phones and tablets on iOS and Android.Draft caret follow-ups (review findings)
0default risked the keyboard opening at the top and prepending on the next keystroke. This also makes the caret feature purely additive — legacy drafts, drafts created on another device, and first opens after the feature shipped keep the long-standing end behavior; only drafts with a saved caret change.caretMapentry).Testing
yarn lintclean,tscclean (pre-existing tsconfig error only), editor reducer tests pass.Summary by CodeRabbit
Bug Fixes
Refactor