Skip to content

The default behavior of useShow hook #2511

Answered by aliemir
vinclou asked this question in Q&A
Discussion options

You must be logged in to vote

Hey @vinclou, that condition is added to support the cases like you use the useShow hook twice, one for using it to fetch the data from url params (like posts/1) and one for fetching the categories/15 data which id is coming from the response of posts/1.

The condition works as an enable/disable switch for useShow to handle asynchronously using the id 15 for categories resource.

We've recently had a discussion on updating this logic since it's limiting the use cases and actually causing a confusion on when to use useShow and when to use useOne. I think we will cover more cases by allowing id only and resource only prop changes and leaving categories/15 calls in posts/1 page to useOne.

I wo…

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@vinclou
Comment options

@vinclou
Comment options

@aliemir
Comment options

@vinclou
Comment options

Answer selected by omeraplak
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants