Skip to content

fix(feedback): Add missing h import in ScreenshotEditor (#12713) #12784

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 8, 2024

Conversation

andreiborza
Copy link
Member

@andreiborza andreiborza commented Jul 5, 2024

This broke the Add a screenshot button on the user feedback, see #12713

This has been explicitly removed in favor of injecting h in #12535 but at that point it seems to be too late to do.

@andreiborza andreiborza requested review from mydea, Lms24 and chargome July 5, 2024 11:42
@andreiborza andreiborza requested a review from a team as a code owner July 5, 2024 11:42
Copy link
Contributor

github-actions bot commented Jul 5, 2024

size-limit report 📦

Path Size
@sentry/browser 22.28 KB (0%)
@sentry/browser (incl. Tracing) 33.43 KB (0%)
@sentry/browser (incl. Tracing, Replay) 69.18 KB (0%)
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 62.51 KB (0%)
@sentry/browser (incl. Tracing, Replay with Canvas) 73.24 KB (0%)
@sentry/browser (incl. Tracing, Replay, Feedback) 85.84 KB (-0.03% 🔽)
@sentry/browser (incl. Tracing, Replay, Feedback, metrics) 87.71 KB (-0.03% 🔽)
@sentry/browser (incl. metrics) 26.57 KB (0%)
@sentry/browser (incl. Feedback) 38.93 KB (-0.02% 🔽)
@sentry/browser (incl. sendFeedback) 26.9 KB (0%)
@sentry/browser (incl. FeedbackAsync) 31.52 KB (0%)
@sentry/react 25.02 KB (0%)
@sentry/react (incl. Tracing) 36.46 KB (0%)
@sentry/vue 26.39 KB (0%)
@sentry/vue (incl. Tracing) 35.29 KB (0%)
@sentry/svelte 22.41 KB (0%)
CDN Bundle 23.5 KB (0%)
CDN Bundle (incl. Tracing) 35.19 KB (0%)
CDN Bundle (incl. Tracing, Replay) 69.29 KB (0%)
CDN Bundle (incl. Tracing, Replay, Feedback) 74.48 KB (0%)
CDN Bundle - uncompressed 68.97 KB (0%)
CDN Bundle (incl. Tracing) - uncompressed 103.98 KB (0%)
CDN Bundle (incl. Tracing, Replay) - uncompressed 214.38 KB (0%)
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 227.09 KB (0%)
@sentry/nextjs (client) 36.35 KB (0%)
@sentry/sveltekit (client) 34.07 KB (0%)
@sentry/node 130.84 KB (0%)
@sentry/node - without tracing 91.86 KB (0%)
@sentry/aws-serverless 117.03 KB (0%)

Comment on lines +4 to +5
// biome-ignore lint/nursery/noUnusedImports: reason
import { h } from 'preact'; // eslint-disable-line @typescript-eslint/no-unused-vars
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we add a reason/additional comment as to why we need this ignore? It looks like h is destructured but unused further below which doesn't look like an unused import on first glance 🤔 is this a biome bug?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh wait, I'm off here, this shouldn't require an import 😅
So I guess there's some side effect we need from importing h?

Copy link
Member Author

@andreiborza andreiborza Jul 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not too familiar with preact, but I'm guessing it's a similar factory to JSX createElement? Just taking a wild guess.

This has been explicitly removed in favor of injecting h in #12535 but at that point it seems to be too late to do.

Maybe we should completely revert the injection too, but I'm waiting on @ryan953 for confirmation before going ahead here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh alright sounds good to me! Sorry, I don't have much context around feedback or Preact and was a bit confused but makes sense!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes h is needed because it's a similar factory to JSX createElement, it's needed anytime JSX syntax is used

@andreiborza andreiborza requested a review from ryan953 July 5, 2024 11:56
@c298lee
Copy link
Contributor

c298lee commented Jul 5, 2024

I think we may have accidentally removed h in #12535 because the screenshot button was breaking when using feedbackAsyncIntegration, but if the screenshot button works with both feedbackSyncIntegration and feedbackAsyncIntegration now, then it looks good to me!

Copy link
Member

@ryan953 ryan953 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool. Lets get this merged!

@ryan953
Copy link
Member

ryan953 commented Jul 8, 2024

Looks like we need #12793. I'll merge the develop branch in

@ryan953 ryan953 merged commit 3883517 into develop Jul 8, 2024
114 of 115 checks passed
@ryan953 ryan953 deleted the ab/fix-feedback-screenshot-button branch July 8, 2024 23:00
andreiborza pushed a commit that referenced this pull request Jul 9, 2024
I noticed this after
#12784, but the
`<CropCorner>` wasn't inside the `ScreenshotEditorFactory()` function.
So of course it wasn't getting access to the `h` ref that is passed in.
That variable is what the `<div>` gets transpiled into -> it becomes
`h.createElement('div')`.

So what i'm doing is moving `CropCorner` into a `CropCornerFactory` so
we can pass `h` in and hopefully not have the extra `import .. from
'preact';` in the 2nd bundle.

Related to #12535
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.

5 participants