Skip to content
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

Only latest Pinia store included in state. #15232

Open
3 tasks done
Parakoos opened this issue Jan 30, 2025 · 1 comment
Open
3 tasks done

Only latest Pinia store included in state. #15232

Parakoos opened this issue Jan 30, 2025 · 1 comment
Assignees
Labels
Package: nuxt Issues related to the Sentry Nuxt SDK

Comments

@Parakoos
Copy link

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/nuxt

SDK Version

8.52.0

Framework Version

Nuxt 3.15.3

Link to Sentry event

https://laik.sentry.io/issues/6257984198/events/c01972b7621d4f579be515ee9f49596e/

Reproduction Example/SDK Setup

https://github.com/Parakoos/nuxt-pinia-sentry-multiple-stores

Steps to Reproduce

  1. Add NUXT_PUBLIC_SENTRY_DNS to .env file in root.
  2. Add SENTRY_AUTH_TOKEN to .env.sentry-build-plugin in root.
  3. Start by running npm run dev
  4. Open the one and only page. On it, there are three tests outlined.

Test 1: captures a Sentry Message without changing the stores.
Test 2: Modifies first the counter store then the announcer store, then captures a Sentry Message.
Test 3: Same as Test 2, but reverses the order in which the two stores are modified.

For each test, reload the page and push the buttons in the order given. Look at the console log and take note of the logged output of the state transformer (which just adds some extra data). Then look at the Sentry Event captured.

Expected Result

Expectation 1: Application State

In Sentry, under 'Context -> Application State', the State Transformer 'transformed' state should include all Pinia stores.

Expectation 2: StateTransformer Input

The State Transformer should get the full state of Pinia, not just the modified store. That way, you can apply changes knowing the structure of the state object.

Actual Result

Actual 1: Application State

Test 1: captures a Sentry Message without changing the stores.

In Sentry, under 'Context -> Application State', there is nothing. The section doesn't even show up.

Test 2: Modifies first the counter store then the announcer store, then captures a Sentry Message.

In Sentry, under 'Context -> Application State', only the announcer store state is given. (with updates from the state transformer)

Test 3: Same as Test 2, but reverses the order in which the two stores are modified.

In Sentry, under 'Context -> Application State', only the counter store state is given. (with updates from the state transformer)

Actual 2: StateTransformer Input

State Transformer is called for each store change, but the state input object only hold the state of the modified store. That means you have to 'figure out' which store was updated by checking the structure of the state object to know which store you are dealing with.

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 3 Jan 30, 2025
@github-actions github-actions bot added the Package: nuxt Issues related to the Sentry Nuxt SDK label Jan 30, 2025
@andreiborza
Copy link
Member

Hi @Parakoos, thanks for filing this and the reproduction repo!

We'll take a look at this but it might take a bit as people in charge of this are currently out of office.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Package: nuxt Issues related to the Sentry Nuxt SDK
Projects
Status: No status
Development

No branches or pull requests

3 participants