Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
update README to include PreloadQuery #303
update README to include PreloadQuery #303
Changes from 2 commits
e9cb1db
4826fdf
fd00faf
0db0284
2528e36
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Technically the first sentence in this section is a paragraph and I don't think you're meaning to reference that one, so I'd use the word "sections" here instead to avoid confusion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alternatively, you can reference the section names with links to really make sure we know what to follow here :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those links will be dead with the first rewording PR, so I'll choose the version without links :D
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The React docs tend to use "Server Components" without the word "React" when referring to them so perhaps we should do the same?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer to be clear here, as we also use "RSC" in places.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we should explain why the
Suspense
boundary here is optional so we can let users know when it should be used. Is this only needed ifClientChild
uses auseSuspenseQuery
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's just entirely optional. It would otherwise suspend up to the next suspense boundary, somewhere in the component tree.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Part of me thinks the "simulated network request" is more of an implementation detail, and I'm not sure if we should care to mention that or not. I do like that you detail how this works in tandom with
useSuspenseQuery
since that is what the user cares about. Perhaps we could remove the implementation detail part of this statement and just keep to the high level overview?(note the change assumes we show
ClientChild
somewhere with auseSuspenseQuery
)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After rereading that, I believe it's useful knowledge for the "Caveat" section.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd recommend an alert here to really call this out as something important. I chose
IMPORTANT
here, butWARNING
orCAUTION
also seems appropriateThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Making the change to the example code, I'd either eliminate this, or move some of this info to a comment in the code block itself.
Like before, I'd recommend explaining when/why its optional. I'm actually surprised it is optional considering
useReadQuery
suspends on pending requests, so if I don't know when, I'm guessing our users won't either :)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this caveat meant for
PreloadQuery
in general or just with the last section? I see this uses a heading level 4 which puts it at the same level as the other two sections, which means its part of the "Preloading data in RSC for usage in Client Components" section.If this is meant for the query ref section, I'd consider removing this heading and putting the next sentence in either a block quote or
NOTE
alertThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It applies to both notations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm actually a little confused at what you're getting at here, mostly because some of this seems a little contradictory. You mention its a "new" network request, but yet it might suffer from being "outdated".
How would one make sure the data is not outdated and how would a user reconcile this? And is "other caching layers" referring to the Next.js
fetch
cache? Some more detail might be helpful here, otherwise you might consider removing this section to avoid confusion.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Example: Your client component cache has up-to-date data from a recent mutation, and you get incoming data from an RSC that is already cached for days because the Next.js fetch cache didn't update.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I hope 2528e36 helps a bit