Evaluate signed-zero equality for QueryObserver snapshots
Mantenedores costumam responder em até 1 dia
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 5/5
- Tempo estimado
- Mais de uma semana
- Facilidade para iniciantes
- 25/100
- Tipo de issue
- Funcionalidade
- Clareza
- Claramente especificada
- Status de atividade
- Ativa
- Stack de tecnologia
- react, typescript
Direção de pesquisa
Start with the signed-zero regression case in packages/query-core/src/__tests__/queryObserver.test.tsx, then read the result comparison in packages/query-core/src/queryObserver.ts and shallowEqualObjects in packages/query-core/src/utils.ts. This issue asks maintainers to decide the intended equality semantics, including effects on notifications, NaN, and snapshot caching; it is design work rather than a scoped first contribution. Done means the behavior is documented and, if changed, regression tests cover the optimistic result, current snapshot, and affected equality and notification behavior.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
Summary
Evaluate whether QueryObserver snapshots should distinguish -0 from 0 when selected placeholder data changes. This is a follow-up for maintainers to decide the desired equality semantics; it does not assume that a global equality change is required.
Reproduction and current behavior
In the signed-zero regression case in packages/query-core/src/__tests__/queryObserver.test.tsx, create an observer with enabled: false, placeholderData: 1, structuralSharing: false, and a selector returning -0. Update the options to use a selector returning 0, then call getOptimisticResult with the updated options.
The PR author verified that the optimistic result contains 0, while getCurrentResult().data still contains -0. The shallow comparison treats these values as equal and preserves the current snapshot. The useQuery render in this case uses the optimistic result.
Decision and affected areas
Review the observer result comparison and update behavior in packages/query-core/src/queryObserver.ts and shallowEqualObjects in packages/query-core/src/utils.ts. Consider whether signed zeros should count as different, and whether any change should be local to observer results or use Object.is semantics more broadly. Assess effects on notifications, render optimizations, other equality cases such as NaN, and the useSyncExternalStore snapshot caching contract.
Acceptance criteria
- Maintainers decide and document the intended signed-zero behavior for observer snapshots.
- If a change is warranted, implement the chosen behavior without breaking snapshot stability or notification semantics.
- If a change is made, add regression coverage for the chosen behavior, including the optimistic result and current snapshot, and cover any affected equality and notification behavior.
Context
- Pull request: https://github.com/TanStack/query/pull/12564
- Review discussion: https://github.com/TanStack/query/pull/12564#discussion_r4509388878
- Requested by: @brennanbutler01
- Linguagem predominante
- TypeScript
- Estrelas
- 50.6k
- Forks
- 4.2k
- Merge médio
- 8h 37min
- PRs com merge (30d)
- 450
Preparar o ambiente
- Sem Dockerfile nem arquivo Docker Compose
- Tem um modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de TanStack/query
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
TanStack/query#12466 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
solid-query: STRICT_READ_UNTRACKED on Solid 2 — client()/options() read in component body (useMutation, useBaseQuery)Talvez livre de novo @LeonxLJX assumiu há 74 dias e não há nenhum pull request aberto. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 84/100
TanStack/query#11358 · 2 comentários · 1 reação ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 25/100
Mantenedores costumam responder em até 1 dia
-
Infinite render loop when select maps keepPreviousData to undefined in v5.105.2+Talvez já em andamento @mooxl assumiu há 6 dias. Aberta
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 35/100
TanStack/query#12574 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
infiniteQuery throws "getNextPageParam is not a function" when 2+ stale pages are cachedTalvez já em andamento @abu-tahir-0 assumiu há 7 dias. Aberta
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 42/100
Mantenedores costumam responder em até 1 dia
Todas as issues de TanStack/query
Issues semelhantes
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 82/100
vercel-labs/ui#809 ·
Mantenedores costumam responder em até 1 dia
-
bot:ai-assisted component:platform-js status:untriaged
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 74/100
midnightntwrk/platform-js#38 ·
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 68/100
ranxianglei/billion-context#7068 ·
Mantenedores costumam responder em até 1 dia
-
vendor: bump whisper.cpp past 6a8addd — the current pin aborts the app on a failed Metal initAberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
mybigday/whisper.rn#348 ·
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
six-group/six-webcomponents#600 ·