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

refactor(react-api-client): fix react query key object hashing for useAllCommandsAsPreSerializedList #15188

Merged
merged 1 commit into from
May 15, 2024

Conversation

ncdiehl11
Copy link
Collaborator

@ncdiehl11 ncdiehl11 commented May 15, 2024

Overview

React query does not properly handle objects passed in useQuery's queryKey array argument that contain keys with undefined values. Here, in useAllCommandsAsPreSerializedList, I map undefined values to null so that they are properly cached and do not trigger a refetch when the host object does not change.

In the future, I will provide a utility for all react-api-client hooks that will sanitize objects with possible undefined values to be included in the queryKey.

tanstack reference

Test Plan

  • start up protocol setup
  • cancel the run before beginning
  • verify that the run preview does not flicker after the run becomes terminal and the 'Run was never started' info screen shows

Changelog

  • map host object undefined values to null

Review requests

@b-cooper per collab

Risk assessment

low

…eAllCommandsAsPreSerializedList

React query does not properly handle objects passed in useQuery's queryKey array argument that
contain keys with `undefined` values. Here, in one instance, I map undefined values to null so that
they are properly cached and do not trigger a refetch when the host object does not change.
@ncdiehl11 ncdiehl11 self-assigned this May 15, 2024
@ncdiehl11 ncdiehl11 requested a review from b-cooper May 15, 2024 16:59
@ncdiehl11 ncdiehl11 marked this pull request as ready for review May 15, 2024 16:59
@ncdiehl11 ncdiehl11 requested a review from a team as a code owner May 15, 2024 16:59
Copy link
Member

@sfoster1 sfoster1 left a comment

Choose a reason for hiding this comment

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

So gross

@ncdiehl11 ncdiehl11 merged commit 755a21b into chore_release-7.3.0 May 15, 2024
14 checks passed
@ncdiehl11 ncdiehl11 deleted the fix_app-run-preview-not-started-2 branch May 15, 2024 17:45
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.

None yet

2 participants