-
Notifications
You must be signed in to change notification settings - Fork 0
Clone main #15
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
base: main
Are you sure you want to change the base?
Clone main #15
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -116,7 +116,11 @@ export function useBaseQuery< | |||||||||||||||
| ) { | ||||||||||||||||
| type ResourceData = QueryObserverResult<TData, TError> | ||||||||||||||||
|
|
||||||||||||||||
| const client = createMemo(() => useQueryClient(queryClient?.())) | ||||||||||||||||
| const client = createMemo( | ||||||||||||||||
| () => useQueryClient(queryClient?.()), | ||||||||||||||||
| useQueryClient(queryClient?.()), | ||||||||||||||||
| ) | ||||||||||||||||
|
Comment on lines
+119
to
+122
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Query Client EqualityInitial value parameter in createMemo causes equality comparison between function result and initial value on every evaluation. This breaks memoization when query client instances differ, leading to unnecessary re-computations and potential query observer recreation. Commitable Suggestion
Suggested change
Standards
Comment on lines
+119
to
+122
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Memo Equality ComparisonMemo equality comparison uses function call result as equality check causing unnecessary re-computations. The useQueryClient call executes on every memo evaluation instead of providing stable equality reference. Standards
|
||||||||||||||||
|
|
||||||||||||||||
| const isRestoring = useIsRestoring() | ||||||||||||||||
| // There are times when we run a query on the server but the resource is never read | ||||||||||||||||
| // This could lead to times when the queryObserver is unsubscribed before the resource has loaded | ||||||||||||||||
|
|
||||||||||||||||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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.
Using
sleepin tests can introduce flakiness. It's generally better to rely onwaitForto check for the expected outcome.In this case, if the
waitForassertion for the success state (child123) passes, it implies that no error was thrown and theerrorHandlerwas not called. You can safely move theexpect(errorHandler).not.toHaveBeenCalled()assertion after thewaitForblock and remove thesleep, making the test more robust.