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

fix(query): add default parameter initializer #60

Merged
merged 1 commit into from
Apr 11, 2024

Conversation

seriouslag
Copy link
Collaborator

@seriouslag seriouslag commented Apr 10, 2024

This PR adds a default parameter initializer if all the properties of the object are optional.

This is an ease-of-use feature that improves DX.

Fixes: Default empty arguments #37

  // if the props tags and limit are optional (using props)
  const { data, error, refetch } = useDefaultServiceFindPets({ tags, limit });
  // before this PR, we would have to pass an object to the hook (not using props)
  const { data, error, refetch } = useDefaultServiceFindPets({});
  // with this PR, we no longer are required to pass an object if all the props are optional (not using props)
  const { data, error, refetch }  = useDefaultServiceFindPets();

This PR adds a default parameter initializer if all the properties of the object are optional.

Fixes: Default empty arguments #37
@seriouslag seriouslag requested a review from 7nohe April 10, 2024 18:49
@seriouslag seriouslag added the enhancement New feature or request label Apr 10, 2024
@7nohe 7nohe merged commit 4e27e41 into main Apr 11, 2024
4 checks passed
@7nohe 7nohe deleted the fix/add-query-property-initializer branch April 11, 2024 14:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants