Skip to content

Conversation

@ryan953
Copy link
Member

@ryan953 ryan953 commented Nov 21, 2025

There's a rename in here which is why a bunch of extra files got touched. Also I have made some extra layers and older systems deprecated. I will try to followup and remove them fully afterwards

@ryan953 ryan953 requested review from a team as code owners November 21, 2025 00:08
@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Nov 21, 2025
Also I have made some extra layers and older systems deprecated. I will try to followup and remove them fully afterwards
@ryan953 ryan953 force-pushed the ryan953/tidy-feedbackButton branch from 5f5f8bf to 9a189b1 Compare November 21, 2025 00:13
@ryan953
Copy link
Member Author

ryan953 commented Nov 21, 2025

@sentry review

Copy link
Member Author

@ryan953 ryan953 Nov 21, 2025

Choose a reason for hiding this comment

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

this was moved into feedbackButton/floatingFeedbackButton.tsx and got parts of useFeedbackWidget inserted into it along with a big docstring, which means git isn't tracking it as a move anymore.

Copy link
Member Author

Choose a reason for hiding this comment

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

this was moved into feedbackButton/feedbackButton.tsx and got parts of useFeedbackWidget inserted into it along with a big docstring, which means git isn't tracking it as a move anymore.

Comment on lines +10 to +13
/**
* @deprecated This layer isn't needed. Call `useFeedbackSDKIntegration` or use `<FeedbackButton/>` or `<FloatingFeedbackButton/>`
*/
export default function useFeedbackWidget({buttonRef}: Props) {
Copy link
Member Author

Choose a reason for hiding this comment

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

this is deprecated now. it's a layer that isn't providing a lot of value.

I've already inlined bits into FeedbackButton and FloatingFeedbackButton,
Next step is cleanup: there's one more callsite to go and remove.

/**
* @deprecated Use components/feedbackButton/feedbackButton.tsx instead.
*/
export default function FeedbackButton() {
Copy link
Member Author

Choose a reason for hiding this comment

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

This name is tooo generic. Wrong FeedbackButton if you found it.

It renders the old-style FeedbackModal in self-serve, or a Zendesk button in SaaS. I plan to replace it with the regular components/feedbackButton/feedbackButton, or we can take it all away too, tbd.

Comment on lines +45 to 48
*
* @deprecated This hook is too low level. Use `<FeedbackButton/>` or `<FloatingFeedbackButton/>` instead.
*/
export function useFeedbackForm() {
Copy link
Member Author

Choose a reason for hiding this comment

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

This hook is doing a lot of what the feedback sdk does already.

This has some comparison logic so that if optionOverrides is deep-equal to the prev value passed we'll re-use the existing form (it's a deep equal compare, not ref compare). For end-users this means their half-written message will pop back open if they re-click the same "Give Feedback" button, or if there are two "Give Feedback" buttons with the same overrides. Clicking a third "Give Feedback" button will clear out the half-written message and show a new form.
Since tags are commonly passed in all the time, this behavior really only impacts places where we're rendering the button in a loop, otherwise options will not be the same between two instances.

We can get very similar behavior if we use feedback.attachTo() instead of feedback.createForm, it'll re-use the existing form if you click the same button twice in a row.

Copy link
Member Author

Choose a reason for hiding this comment

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

Turns out this hook is also useful for times when the Button is inside a Dropdown or similar. The button might be unmounted but we don't want the feedback dialog to also unmount. The feedback dialog should be opened but not tethered to the lifecycle of the button that opened it.

@ryan953 ryan953 merged commit 4b6928d into master Nov 24, 2025
48 checks passed
@ryan953 ryan953 deleted the ryan953/tidy-feedbackButton branch November 24, 2025 16:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants