-
Notifications
You must be signed in to change notification settings - Fork 143
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
fix: dont require double click to show feedback surveys #1767
fix: dont require double click to show feedback surveys #1767
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Summary
This PR adds a new onSurveyDismissedOrSent
callback function to the SurveyContext to fix an issue with widget-type surveys requiring double clicks to reappear after dismissal.
- Added
onSurveyDismissedOrSent
callback toSurveyContext
interface insrc/extensions/surveys/surveys-utils.tsx
with a default no-op implementation - Implemented the callback in
SurveyPopup
component insrc/extensions/surveys.tsx
to properly handle survey state - Added callback invocation when surveys are dismissed or completed to reset widget state
- Fixed the issue where widget-type surveys required two clicks to show again after being dismissed
2 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings | Greptile
Size Change: +1.96 kB (+0.06%) Total Size: 3.32 MB
ℹ️ View Unchanged
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LG. Just a suggestion/observation - We already have handleCloseSurveyPopup
can we use that for dismissing and just add a new onSurveySent
?
yeah I wonder if |
I agree this is probably confusing, and there's a refactor somewhere we can do to make the logic be more sound but it's not on the scope of this PR specifically - where I'm mainly looking for adding a callback that will be triggered on both cases (dismissing or sending the survey) |
I think the confusion here is that there are one action and 2 callback options I'd rather do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
left a last question here
i might be misunderstanding the behaviour of both callbacks, so feel free to explain and merge it if that's the case
@marandaneto @ioannisj i made the callbacks be more clear now please take another look before I merge 🙏 |
src/extensions/surveys.tsx
Outdated
const { | ||
isPreviewMode, | ||
previewPageIndex, | ||
onPopupSurveyDismissed: handleCloseSurveyPopup, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isnt handleCloseSurveyPopup
renamed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thats what I get from trusting the automatic renaming; i'll fix all of those and merge
src/extensions/surveys.tsx
Outdated
{isPopup && ( | ||
<Cancel | ||
onClick={() => { | ||
handleCloseSurveyPopup() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
src/extensions/surveys.tsx
Outdated
onPopupSurveyDismissed: handleCloseSurveyPopup, | ||
isPopup, | ||
onPreviewSubmit, | ||
onPopupSurveySent: onSurveyDismissedOrSent, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isnt onSurveyDismissedOrSent
renamed?
@@ -1071,6 +1073,81 @@ describe('useHideSurveyOnURLChange', () => { | |||
}) | |||
}) | |||
|
|||
describe('onSurveyDismissedOrSent callback', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tests are using the old callback names
Changes
adds a new option on SurveyContext to do something after a survey is submitted.
also, right now, for widget-type surveys (tab style), we have to click on the button twice to show the survey again after dismissing it. this PR fixes that
Checklist