storybookjs/storybook

[Bug]: Vue KeepAlive onActivated dose NOT work in storybook decorators

Aperta

#27.149 aperta il 15 mag 2024

 (0 commenti) (0 reazioni) (0 assegnatari)TypeScript (10.058 fork)batch import
bughelp wantedvue3

Metriche repository

Star
 (89.909 stelle)
Metriche merge PR
 (Merge medio 7g 22h) (184 PR mergiate in 30 g)

Descrizione

Describe the bug

See Reproduce: As story title said, in 'On Activated Dose Not Invock', onActivated dosen't be called.

export default {
  title: 'Example/Page2',
  component: Page,
  decorators: [
    (story) => ({
      components: { story },
      template: `<KeepAlive><story /></KeepAlive>`, // differece: use story, not Page
    }),
  ],
};

image

But in Keepalive Works Fine, onActivatedis called.

export default {
  title: 'Example/Page',
  component: Page,
  decorators: [
    (story) => ({
      components: { Page },
      template: `<KeepAlive><Page /></KeepAlive>`,
    }),
  ],
};

image

To Reproduce

https://stackblitz.com/edit/github-lfs33b

System

Storybook Environment Info:

  System:
    OS: macOS 14.4.1
    CPU: (12) arm64 Apple M2 Pro
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 18.15.0 - ~/.nvm/versions/node/v18.15.0/bin/node
    npm: 9.5.0 - ~/.nvm/versions/node/v18.15.0/bin/npm
    pnpm: 8.14.1 - ~/.nvm/versions/node/v18.15.0/bin/pnpm <----- active
  Browsers:
    Chrome: 124.0.6367.158
    Safari: 17.4.1

Additional context

No response

Guida contributor