Skip to content

Conversation

@AbhiPrasad
Copy link
Member

@AbhiPrasad AbhiPrasad commented Mar 7, 2023

Closes #7343

This PR adds a basic schema for hooks in the SDK. They live on the client.

Currently there are three hooks defined, but none of them are implemented. They are beforeTransaction, transactionFinish, and beforeEnvelope.

@AbhiPrasad AbhiPrasad self-assigned this Mar 7, 2023
@AbhiPrasad AbhiPrasad marked this pull request as ready for review March 8, 2023 15:23
@github-actions
Copy link
Contributor

github-actions bot commented Mar 8, 2023

size-limit report 📦

Path Size
@sentry/browser - ES5 CDN Bundle (gzipped + minified) 20.22 KB (+0.51% 🔺)
@sentry/browser - ES5 CDN Bundle (minified) 62.89 KB (+0.6% 🔺)
@sentry/browser - ES6 CDN Bundle (gzipped + minified) 18.85 KB (+0.53% 🔺)
@sentry/browser - ES6 CDN Bundle (minified) 55.8 KB (+0.56% 🔺)
@sentry/browser - Webpack (gzipped + minified) 20.6 KB (+0.5% 🔺)
@sentry/browser - Webpack (minified) 67.32 KB (+0.5% 🔺)
@sentry/react - Webpack (gzipped + minified) 20.62 KB (+0.47% 🔺)
@sentry/nextjs Client - Webpack (gzipped + minified) 48.36 KB (+0.18% 🔺)
@sentry/browser + @sentry/tracing - ES5 CDN Bundle (gzipped + minified) 27.35 KB (+0.33% 🔺)
@sentry/browser + @sentry/tracing - ES6 CDN Bundle (gzipped + minified) 25.62 KB (+0.41% 🔺)
@sentry/replay ES6 CDN Bundle (gzipped + minified) 43.15 KB (+0.08% 🔺)
@sentry/replay - Webpack (gzipped + minified) 37.16 KB (0%)
@sentry/browser + @sentry/tracing + @sentry/replay - ES6 CDN Bundle (gzipped + minified) 61.01 KB (+0.18% 🔺)
@sentry/browser + @sentry/replay - ES6 CDN Bundle (gzipped + minified) 54.31 KB (+0.16% 🔺)

@mydea
Copy link
Member

mydea commented Mar 8, 2023

I pushed some changes onto this branch to use generics for type safety. I tried it locally and it seems to give me correct type safety as long as you specify the generic. Not sure if there is a way to enforce to provide the generic, not infer it 😅 but you can at least opt into type safety this way, and as an additional plus you only need to edit/add new hook types in a single place now!

@mydea
Copy link
Member

mydea commented Mar 8, 2023

cc @AbhiPrasad & @lforst refactored this again based on our discussion, looks good now I think, and the tests should also cover this decently (both the client & testclient case)

@AbhiPrasad AbhiPrasad enabled auto-merge (squash) March 8, 2023 18:18
@AbhiPrasad AbhiPrasad merged commit 3eeef09 into develop Mar 8, 2023
@AbhiPrasad AbhiPrasad deleted the abhi-hooks branch March 8, 2023 19:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add hook interface to BaseClient and Client type

3 participants