Skip to content
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

UseInViewSelect #8924

Merged
merged 7 commits into from
Jun 26, 2024
Merged

UseInViewSelect #8924

merged 7 commits into from
Jun 26, 2024

Conversation

zutigrm
Copy link
Collaborator

@zutigrm zutigrm commented Jun 24, 2024

Summary

Addresses issue:

Relevant technical choices

PR Author Checklist

  • My code is tested and passes existing unit tests.
  • My code has an appropriate set of unit tests which all pass.
  • My code is backward-compatible with WordPress 5.2 and PHP 7.4.
  • My code follows the WordPress coding standards.
  • My code has proper inline documentation.
  • I have added a QA Brief on the issue linked above.
  • I have signed the Contributor License Agreement (see https://cla.developers.google.com/).

Do not alter or remove anything below. The following sections will be managed by moderators only.

Code Reviewer Checklist

  • Run the code.
  • Ensure the acceptance criteria are satisfied.
  • Reassess the implementation with the IB.
  • Ensure no unrelated changes are included.
  • Ensure CI checks pass.
  • Check Storybook where applicable.
  • Ensure there is a QA Brief.

Merge Reviewer Checklist

  • Ensure the PR has the correct target branch.
  • Double-check that the PR is okay to be merged.
  • Ensure the corresponding issue has a ZenHub release assigned.
  • Add a changelog message to the issue.

Copy link

github-actions bot commented Jun 24, 2024

Build files for 8672821 have been deleted.

This comment was marked as resolved.

Copy link
Collaborator

@eugene-manuilov eugene-manuilov left a comment

Choose a reason for hiding this comment

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

Thanks, @zutigrm. Mostly looks good to me. Left one comment.

assets/js/hooks/useInViewSelect.js Outdated Show resolved Hide resolved
@zutigrm
Copy link
Collaborator Author

zutigrm commented Jun 25, 2024

@eugene-manuilov Thanks, I updated PR. I noticed that few key metrics widgets were stuck in loading state, so after digging up a bit, I also needed to update the usage of this hook, as we tend to use it for fetching reports, so I updated the usage to include proper dependencies - beside the initial resolution of some dependencies, report options can update when reference date is changed on the dashboard, so this PR grew a bit in number of files that needed editing.

Copy link
Collaborator

@eugene-manuilov eugene-manuilov left a comment

Choose a reason for hiding this comment

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

Great job, @zutigrm. Almost looks good to me. Left two minor comments for you and then it should be good to go.

@zutigrm
Copy link
Collaborator Author

zutigrm commented Jun 26, 2024

Thanks @eugene-manuilov , PR updated

Copy link
Collaborator

@eugene-manuilov eugene-manuilov left a comment

Choose a reason for hiding this comment

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

Thanks, @zutigrm. LGTM.

@eugene-manuilov eugene-manuilov merged commit 8176f38 into develop Jun 26, 2024
21 checks passed
@eugene-manuilov eugene-manuilov deleted the enhancement/8789-useinviewselect branch June 26, 2024 10:26
@aaemnnosttv
Copy link
Collaborator

I noticed that few key metrics widgets were stuck in loading state, so after digging up a bit, I also needed to update the usage of this hook, as we tend to use it for fetching reports, so I updated the usage to include proper dependencies - beside the initial resolution of some dependencies, report options can update when reference date is changed on the dashboard, so this PR grew a bit in number of files that needed editing.

Thanks @zutigrm – while I'm not opposed to the addition of dependencies in the usage, it shouldn't have been necessary here. This is likely due to a related flaw in the initial implementation which set deps = [] by default. The inclusion of the mapSelect in deps which this issue was intended to fix prevented this from being a problem since mapSelect was always different. Removing it caused our deps to use the default empty array in any instance where we weren't passing deps explicitly. This resulted in the selector callback never updating when its dependencies changed. Again, it's good to address, but it ultimately resulted in a much larger change than was necessary.

I've opened #9009 to address the fix for the default.

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.

3 participants