Skip to content

dataUpdatedAt incorrect for streamed queries that resolve before hydration #10603

@Ephem

Description

@Ephem

Describe the bug

I broke it in this PR: #10444

dataUpdatedAt for !hasData defaults to 0. Previously when hydrating a streamed query that had time to resolve before the time of hydration (that is, pending at dehydration, success at hydration), we still called query.fetch just to set up a retryer. This part was not necessary, but removing it also means we no longer update the dataUpdatedAt to a correct value, so it stays 0.

The hydration path needs to set this when the query was successful. Since we don't know the time it resolved on the server, we should fallback to Date.now() which is what the fetch was doing before.

We should also verify that no other values are faulty after the query.fetch removal.

I plan to fix this asap.

(Update: I haven't verified all details a 100% yet, but I'm pretty confident this was the mechanism that broke it)

Your minimal, reproducible example

N/A

Steps to reproduce

N/A

Expected behavior

dataUpdatedAt should get set.

How often does this bug happen?

None

Screenshots or Videos

No response

Platform

N/A

Tanstack Query adapter

None

TanStack Query version

5.100.1

TypeScript version

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions