Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions src/core/query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,14 +197,12 @@ export class Query<TResult, TError> {
// Get the new data
let data: TResult | undefined = functionalUpdate(updater, prevData)

// Structurally share data between prev and new data if needed
if (this.config.structuralSharing) {
data = replaceEqualDeep(prevData, data)
}

// Use prev data if an isDataEqual function is defined and returns `true`
if (this.config.isDataEqual?.(prevData, data)) {
data = prevData
} else if (this.config.structuralSharing) {
// Structurally share data between prev and new data if needed
data = replaceEqualDeep(prevData, data)
}

// Try to determine if more data can be fetched
Expand Down