Skip to content

Values provided from app are undefined when using inject in Pinia setup store #11602

Closed
@Anoesj

Description

@Anoesj

Vue version

3.4.37

Link to minimal reproduction

https://stackblitz.com/edit/github-tg21by-ju6avc?file=components%2FHi.vue

Steps to reproduce

Injections in Pinia stores are broken as of Vue 3.4.37. I'm assuming this to be a regression caused by this PR: #11502, as it seems to be the only change in 3.4.37 related to the provide/inject system.

Note that the reproduction is made with the Nuxt starter template, as I thought this was a Nuxt bug at first. Running Nuxt without SSR results in the same bug, so I'm expecting this to be a bug solely related to Vue, not nuxt, pinia and/or @pinia/nuxt.

Repro for 3.4.37 (injections always undefined): see repro link above
Repro for 3.4.36 (injections working as expected): https://stackblitz.com/edit/github-tg21by-mkqgva?file=components%2FHi.vue

What is expected?

Values provided by app.vue are available in the Pinia store by using inject.

What is actually happening?

All injected values are undefined.

System Info

System:
    OS: Linux 6.5 Ubuntu 22.04.4 LTS 22.04.4 LTS (Jammy Jellyfish)
    CPU: (16) x64 AMD Ryzen 7 5800H with Radeon Graphics
    Memory: 7.20 GB / 13.49 GB
    Container: Yes
    Shell: 5.1.16 - /bin/bash
  Binaries:
    Node: 20.12.2 - ~/.local/share/pnpm/node
    npm: 10.5.0 - ~/.local/share/pnpm/npm
    pnpm: 9.7.0 - ~/.local/share/pnpm/pnpm
    bun: 1.1.17 - ~/.bun/bin/bun
  Browsers:
    Chrome: 127.0.6533.99

Note that the bug is also present in the Stackblitz environment, so I don't think this is a system-specific problem.

Any additional comments?

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions