Skip to content

SanityLive invalidates ALL queries on any document publishΒ #2542

@ragnsan

Description

@ragnsan

Describe the bug

We're running into an issue where SanityLive invalidates ALL queries in our sites when publishing any document in the Sanity studio. Doesn't matter if the document being published is even used any query. Simple reproduction showcasing and explaining the issue:
https://cap.so/s/w8e7yqbz3vg1j9g

To Reproduce

  1. Install the Next.js Sanity starter via https://www.sanity.io/manage?template=nextjs-sanity-clean&ref=nextjs-cms&new-project= or npm create sanity@latest -- --template sanity-io/sanity-template-nextjs-clean
  2. Add a random document type
  3. Add the document type to the schemaTypes index.ts file
  4. Run a build with npm run build
  5. Make requests with httpie, curl or visit a couple of pages and see that you get a cache hit
  6. Open the Sanity studio and make a new document of the random document type
  7. Make a new httpie/curl/visit the pages and see that you get a cache miss
  8. Make a new request and see that you get a cache hit

Expected behavior

Sanity live invalidating only the data / cache / queries that are affected by a change.

Which versions of Sanity are you using?

Happens with any version combination I've tried, but these are the versions installed in the starter

frontend folder:
@sanity/cli (global) 3.90.0 (latest: 3.97.1)
@sanity/image-url 1.1.0 (up to date)
@sanity/uuid 3.0.2 (up to date)
sanity 3.97.1 (up to date)

studio folder:
@sanity/cli (global) 3.90.0 (latest: 3.97.1)
@sanity/assist 4.3.0 (latest: 4.4.1)
@sanity/eslint-config-studio 5.0.2 (up to date)
@sanity/icons 3.7.4 (up to date)
@sanity/vision 3.97.1 (up to date)
sanity 3.97.1 (up to date)

What operating system are you using?

MacOS

Which versions of Node.js / npm are you running?

10.9.2
v22.16.0

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