Skip to content

fix(new-widget-builder-experience): Add queries to handleBlur dependency list#33260

Merged
narsaynorath merged 2 commits intomasterfrom
fix/new-widget-builder-experience-blurring-filters-wipes-query-state
Apr 4, 2022
Merged

fix(new-widget-builder-experience): Add queries to handleBlur dependency list#33260
narsaynorath merged 2 commits intomasterfrom
fix/new-widget-builder-experience-blurring-filters-wipes-query-state

Conversation

@narsaynorath
Copy link
Copy Markdown
Member

@narsaynorath narsaynorath commented Apr 4, 2022

The handleBlur has a dependency on queries, which was not updating
when the query length would change. This stale data meant that there
could be an indexing issue that malforms our query structure, leading to
a validation bug

The problem is that the useCallback hook doesn't update the queries list properly when it updates (either when the widget builder re-renders and fills with data, or when starting fresh and adding fields), leading to the queries[queryIndex] index to return undefined, which wipes out a bunch of expected fields. The solution is to pass queries to useCallback so it updates.

Fixes #33236

The handleBlur has a dependency on queries, which was not updating
when the query length would change. This stale data meant that there
could be an indexing issue that malforms our query structure, leading to
a validation bug
Copy link
Copy Markdown
Contributor

@edwardgou-sentry edwardgou-sentry left a comment

Choose a reason for hiding this comment

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

LGTM, also confirmed it fixes the undefined reference issue.

@narsaynorath narsaynorath merged commit c9acf48 into master Apr 4, 2022
@narsaynorath narsaynorath deleted the fix/new-widget-builder-experience-blurring-filters-wipes-query-state branch April 4, 2022 21:31
@priscilawebdev
Copy link
Copy Markdown
Member

Thanks for fixing it @narsaynorath 🌮

}
};
},
[queries]
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

oh that was the queries... funny, I would have fixed this in the PR #33241

Copy link
Copy Markdown
Member

@priscilawebdev priscilawebdev Apr 5, 2022

Choose a reason for hiding this comment

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

we have to do the same with handleSearch 😉

@github-actions github-actions Bot locked and limited conversation to collaborators Apr 20, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Error in editing/creating Widget on custom dashboard

3 participants