feat(devtools): add copy path to source inspector#419
feat(devtools): add copy path to source inspector#419harry-whorlow wants to merge 2 commits intomainfrom
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughAdds a configurable Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Poem
🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (1 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 |
🚀 Changeset Version Preview1 package(s) bumped directly, 4 bumped as dependents. 🟨 Minor bumps
🟩 Patch bumps
|
|
View your CI Pipeline Execution ↗ for commit b301327
☁️ Nx Cloud last updated this comment at |
More templates
@tanstack/devtools
@tanstack/devtools-a11y
@tanstack/devtools-client
@tanstack/devtools-ui
@tanstack/devtools-utils
@tanstack/devtools-vite
@tanstack/devtools-event-bus
@tanstack/devtools-event-client
@tanstack/preact-devtools
@tanstack/react-devtools
@tanstack/solid-devtools
@tanstack/vue-devtools
commit: |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
packages/devtools/src/components/source-inspector.tsx (1)
103-106: Consider providing user feedback on clipboard failure.The clipboard write silently catches errors with
.catch(() => {}). If the clipboard operation fails (e.g., due to permissions or non-secure context), the user receives no feedback.This matches the existing pattern for the fetch call on line 116, so it's consistent. However, for better UX, you could consider showing a brief toast or visual indicator on success/failure.
💡 Optional: Add minimal user feedback
if (settings().sourceAction === 'copy-path') { - navigator.clipboard.writeText(highlightState.dataSource).catch(() => {}) + navigator.clipboard + .writeText(highlightState.dataSource) + .then(() => { + // Optional: Show brief success indicator + }) + .catch(() => { + // Optional: Show brief error indicator or fallback + }) return }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/devtools/src/components/source-inspector.tsx` around lines 103 - 106, The clipboard write currently swallows errors in the settings().sourceAction === 'copy-path' branch (navigator.clipboard.writeText(highlightState.dataSource).catch(() => {})); change this to provide minimal user feedback by handling both success and failure: call navigator.clipboard.writeText(...).then(() => /* show success toast/visual indicator */).catch(err => /* show error toast/visual indicator with err.message */), reusing the same toast/notification pattern used for the nearby fetch call so messages are consistent with the rest of the UI.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@packages/devtools/src/components/source-inspector.tsx`:
- Around line 103-106: The clipboard write currently swallows errors in the
settings().sourceAction === 'copy-path' branch
(navigator.clipboard.writeText(highlightState.dataSource).catch(() => {}));
change this to provide minimal user feedback by handling both success and
failure: call navigator.clipboard.writeText(...).then(() => /* show success
toast/visual indicator */).catch(err => /* show error toast/visual indicator
with err.message */), reusing the same toast/notification pattern used for the
nearby fetch call so messages are consistent with the rest of the UI.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 814106ec-0d30-43fe-ad2c-078ed1a3c55f
📒 Files selected for processing (5)
.changeset/icy-states-chew.mddocs/source-inspector.mdexamples/react/basic/src/setup.tsxpackages/devtools/src/components/source-inspector.tsxpackages/devtools/src/context/devtools-store.ts
Summary by CodeRabbit
New Features
filepath:line:columnto clipboard; clicking now copies when set and shows a pointer cursor while active.Documentation
Examples
copy-pathaction by default.