Analytics: track export_dialog_opened and export_dialog_dismissed#1773
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe export dialog hook now accepts collection and format context, tracks open and dismissal analytics, suppresses dismissal events after downloads, and resets session state on reopening. Header and dialog integrations pass the required context, with the hook exported centrally and covered by tests. ChangesExport dialog analytics
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant HeaderMenu
participant ExportSamples
participant useExportDialog
participant PostHog
HeaderMenu->>useExportDialog: openExportDialog({ collectionId })
ExportSamples->>useExportDialog: openExportDialog({ collectionId })
useExportDialog->>PostHog: track export_dialog_opened
ExportSamples->>useExportDialog: closeExportDialog({ collectionId, exportFormat })
useExportDialog->>PostHog: track export_dialog_dismissed when no download occurred
Possibly related PRs
Suggested reviewers: 🚥 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 |
❌ Fast Track: checks did not pass
To run the guardrails locally, from Reflects |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4b62b921b1
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 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 `@lightly_studio_view/src/lib/components/ExportSamples/ExportSamples.svelte`:
- Around line 190-193: Update the export/download flow in the ExportSamples
component to retrieve and invoke markDownloadClicked for every export action
before closeExportDialog runs. Ensure the onOpenChange close path marks the
download before closing so completed exports do not emit
export_dialog_dismissed, while preserving the existing open behavior.
In `@lightly_studio_view/src/lib/hooks/useExportDialog/useExportDialog.test.ts`:
- Around line 11-13: Update the useGlobalStorage mock in the export dialog tests
to provide a non-zero filteredSampleCount, then replace the permissive analytics
assertion with an exact expectation for that value. Apply the same change to the
additional assertion range so the forwarded analytics payload is verified
consistently.
🪄 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: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 91606fc1-269b-4230-af4f-aefab80f6785
📒 Files selected for processing (5)
lightly_studio_view/src/lib/components/ExportSamples/ExportSamples.sveltelightly_studio_view/src/lib/components/Header/Menu.sveltelightly_studio_view/src/lib/hooks/index.tslightly_studio_view/src/lib/hooks/useExportDialog/useExportDialog.test.tslightly_studio_view/src/lib/hooks/useExportDialog/useExportDialog.ts
What has changed and why?
Instruments the export-dialog lifecycle events in
useExportDialog.Events added:
export_dialog_opened- fires on open; capturescollection_idandfiltered_sample_countfrom global storage.export_dialog_dismissed-fires on close; capturescollection_idand the format selected at dismiss time.How has it been tested?
Unit tests.
Did you update CHANGELOG.md?
Summary by CodeRabbit