Skip to content

Pinia colada queries trigger too often #598

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

Open
teleskop150750 opened this issue Mar 11, 2025 · 5 comments
Open

Pinia colada queries trigger too often #598

teleskop150750 opened this issue Mar 11, 2025 · 5 comments
Labels
🐞 bug this isn't working as expected

Comments

@teleskop150750
Copy link

teleskop150750 commented Mar 11, 2025

If you open a site with a page with a loader, it stops being tracked

This problem is present in nuxt (SSR false or true)

nuxt/loader

In vue such problem is not noticed

vue/loader

2025-03-11.11-53-07.mp4

logging shows that entry is not active

const invalidateQueries = action((filters) => {
    return Promise.all(
      getEntries(filters).map((entry) => {
        invalidate(entry); console.error('invalidateQueries', entry, entry.active, toValue(entry.options?.enabled));
        return entry.active && toValue(entry.options?.enabled) && fetch(entry);
      })
    );
  });
@teleskop150750 teleskop150750 changed the title Pinia colada is not tracked Pinia colada is not tracked in Nuxt Mar 11, 2025
@teleskop150750
Copy link
Author

UPD: video

@posva
Copy link
Owner

posva commented Mar 11, 2025

Describe precisely what are you execting to happen vs what is happening please

@teleskop150750
Copy link
Author

@posva

What is expected?

I expect all three queries to be updated.

What is actually happening?

all requests are updated except the first one


the first request is not tracked because it is on the page from which the site is opened

@teleskop150750
Copy link
Author

teleskop150750 commented Mar 11, 2025

What is expected?
Update one two three

2025-03-11.12-43-54.mp4

What is actually happening?

Update two three

2025-03-11.12-44-35.mp4

@posva posva added the 🐞 bug this isn't working as expected label Mar 15, 2025
@posva
Copy link
Owner

posva commented Mar 15, 2025

This is a bug but the intended behavior would be for only the current page to automatically refetch. This is because by default only active queries are refetched. You will be able to pass an option to invalidateQueries() to have the behavior you want (invalidate inactive too) but currently only active queries are refetched (bug in Pinia Colada, already tracked)

@posva posva changed the title Pinia colada is not tracked in Nuxt Pinia colada queries trigger too often Mar 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞 bug this isn't working as expected
Projects
Status: 🆕 New
Development

No branches or pull requests

2 participants