feat(plugin-sentry): add plugin for sentry#547
Conversation
🦋 Changeset detectedLatest commit: 2d09def The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
|
Hello @ysh4296! It's the end of the year and we're currently busy with other work, so the review is delayed. I think it will be possible early next year, so please keep that in mind. |
- Separate Sentry init from plugin (user inits Sentry, plugin handles navigation spans) - Move @sentry/browser, @sentry/core, @stackflow/core to peerDependencies - Replace internal WINDOW import with direct window check - Remove unsafe integrations type cast - Extract shared navigation span helper and add breadcrumb support - Upgrade devDependencies to @sentry/browser@10, @sentry/core@10 - Fix version field typo (commas to dots) - Update README with two-step setup guide Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…set to minor Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ❌ Deployment failed View logs |
stackflow-docs | 3a116b3 | Mar 30 2026, 10:08 AM |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
📝 WalkthroughSummary by CodeRabbit
WalkthroughAdds a new Changes
Sequence DiagramsequenceDiagram
participant App as App
participant Stackflow as Stackflow Core
participant Plugin as Sentry Plugin
participant Sentry as Sentry Client
participant Browser as Browser
App->>Stackflow: navigation action (push/pop/replace / step events)
Stackflow->>Plugin: emit lifecycle event (onPushed/onPopped/...)
Plugin->>Sentry: start navigation span (name, attributes, params)
Sentry->>Browser: record span
Plugin->>Sentry: add breadcrumb (message, data)
Sentry->>Browser: record breadcrumb
Plugin->>Stackflow: plugin hook complete
Stackflow->>App: navigation complete
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 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
🧹 Nitpick comments (2)
extensions/plugin-sentry/README.md (1)
24-37: Consider adding a typed activity example.The setup example shows the plugin integration but doesn't demonstrate TypeScript type safety for activities and their parameters. Adding a brief typed example would help users understand how to properly type their Stackflow activities:
📚 Suggested enhancement
```typescript import { stackflow } from "@stackflow/react"; import { sentryPlugin } from "@stackflow/plugin-sentry"; +type Activities = { + HomePage: {}; + ArticlePage: { + articleId: string; + }; +}; + -const { Stack, useFlow } = stackflow({ +const { Stack, useFlow } = stackflow<Activities>({ activities: { - // ... + HomePage: HomePage, + ArticlePage: ArticlePage, }, plugins: [ sentryPlugin(), // ... other plugins ], }); ```As per coding guidelines, TypeScript type safety should be provided for activities and their parameters using strict typing.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@extensions/plugin-sentry/README.md` around lines 24 - 37, The README example for integrating sentryPlugin lacks a TypeScript-typed activities example; add a concise typed snippet that declares an Activities type (e.g., type Activities = { HomePage: {}; ArticlePage: { articleId: string } }), then call stackflow with the generic stackflow<Activities> and list the activities (HomePage, ArticlePage) in the activities map so consumers see correct type safety for useFlow/Stack and plugin usage (referencing sentryPlugin, stackflow, Stack, useFlow, HomePage, ArticlePage, and Activities).extensions/plugin-sentry/package.json (1)
30-30: Dev script won't run TypeScript watcher concurrently.The
&&operator meansbuild:dts --watchwill only start afterbuild:js --watchexits, but in watch mode it never exits. Consider usingconcurrentlyor similar to run both watchers in parallel.Proposed fix using parallel execution
- "dev": "yarn build:js --watch && yarn build:dts --watch" + "dev": "yarn build:js --watch & yarn build:dts --watch"Or add a dependency on
concurrently:"dev": "concurrently \"yarn build:js --watch\" \"yarn build:dts --watch\""🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@extensions/plugin-sentry/package.json` at line 30, The "dev" npm script uses && which runs "build:dts --watch" only after "build:js --watch" exits (and watch never exits), so the d.ts watcher never starts; update the "dev" script (the "dev" entry in package.json) to run both watchers in parallel — e.g., use a tool like concurrently to run "yarn build:js --watch" and "yarn build:dts --watch" at the same time so both watchers (build:js and build:dts) start and stay active concurrently.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.changeset/fix-plugin-sentry.md:
- Line 5: Update the changeset message string "fix(plugin-sentry): decouple
Sentry init from plugin, fix dependency structure, remove internal API usage" to
accurately describe that this PR adds a new plugin package (e.g., use
"feat(plugin-sentry): add new Sentry plugin package" or similar), ensure the
changeset body mentions it's an addition rather than a fix, and keep any
dependency notes intact so release tooling will treat it as a new feature.
---
Nitpick comments:
In `@extensions/plugin-sentry/package.json`:
- Line 30: The "dev" npm script uses && which runs "build:dts --watch" only
after "build:js --watch" exits (and watch never exits), so the d.ts watcher
never starts; update the "dev" script (the "dev" entry in package.json) to run
both watchers in parallel — e.g., use a tool like concurrently to run "yarn
build:js --watch" and "yarn build:dts --watch" at the same time so both watchers
(build:js and build:dts) start and stay active concurrently.
In `@extensions/plugin-sentry/README.md`:
- Around line 24-37: The README example for integrating sentryPlugin lacks a
TypeScript-typed activities example; add a concise typed snippet that declares
an Activities type (e.g., type Activities = { HomePage: {}; ArticlePage: {
articleId: string } }), then call stackflow with the generic
stackflow<Activities> and list the activities (HomePage, ArticlePage) in the
activities map so consumers see correct type safety for useFlow/Stack and plugin
usage (referencing sentryPlugin, stackflow, Stack, useFlow, HomePage,
ArticlePage, and Activities).
🪄 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: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: e7cb965f-2f38-434a-ab1f-a1db83953cba
⛔ Files ignored due to path filters (7)
.yarn/cache/@sentry-browser-npm-10.46.0-91e2f4dcc5-f447c01f96.zipis excluded by!**/.yarn/**,!**/*.zip.yarn/cache/@sentry-core-npm-10.46.0-8ff3972576-bbe823f9de.zipis excluded by!**/.yarn/**,!**/*.zip.yarn/cache/@sentry-internal-browser-utils-npm-10.46.0-c2bfafc8a9-6ae7c6cc8d.zipis excluded by!**/.yarn/**,!**/*.zip.yarn/cache/@sentry-internal-feedback-npm-10.46.0-94a0d30ebb-e6c0b1fa93.zipis excluded by!**/.yarn/**,!**/*.zip.yarn/cache/@sentry-internal-replay-canvas-npm-10.46.0-e0dee1cb26-0ddfacfc79.zipis excluded by!**/.yarn/**,!**/*.zip.yarn/cache/@sentry-internal-replay-npm-10.46.0-21ab33d9b1-e7c3e9e880.zipis excluded by!**/.yarn/**,!**/*.zipyarn.lockis excluded by!**/yarn.lock,!**/*.lock
📒 Files selected for processing (9)
.changeset/fix-plugin-sentry.md.pnp.cjsextensions/plugin-sentry/README.mdextensions/plugin-sentry/esbuild.config.jsextensions/plugin-sentry/package.jsonextensions/plugin-sentry/src/index.tsextensions/plugin-sentry/src/integration.tsextensions/plugin-sentry/src/sentryPlugin.tsextensions/plugin-sentry/tsconfig.json
commit: |
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
plugin-sentry (Issue from #520)
Stackflow has a unique screen handling with "Activity."
Currently, Sentry doesn't support tracing for this mechanism,
So we had to create own plugin.
This pr contains a basic functional plugin that works for:
How I Tested It:
Screen shots & additional explanation
Performance
Error Tracing
Note
I'm not sure if this is the 'desired' behavior, so I would appreciate any feedback.