Skip to content

Only latest Pinia store included in state. #15232

Open
@Parakoos

Description

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.

Metadata

Assignees

Labels

Package: nuxtIssues related to the Sentry Nuxt SDK

Type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions