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

Global story controls not working for vue2 #266

Closed
6 tasks done
minddust opened this issue Aug 24, 2022 · 5 comments
Closed
6 tasks done

Global story controls not working for vue2 #266

minddust opened this issue Aug 24, 2022 · 5 comments
Assignees
Labels
bug Something isn't working vue2

Comments

@minddust
Copy link

Describe the bug

Global controls within story #controls slot are not showing up.
same controls within variant #controls slot are working fine.

Reproduction

works

<template>
  <Story>
    <Variant>
      <template #controls>control</template>
      variant
    </Variant>
  </Story>
</template>

doesn't work

<template>
  <Story>
    <template #controls>control</template>
    <Variant>variant</Variant>
  </Story>
</template>

Based on docs: https://histoire.dev/guide/vue2/controls.html#controls-panel

System Info

System:
    OS: macOS 12.5.1
    CPU: (8) x64 Intel(R) Core(TM) i7-8559U CPU @ 2.70GHz
    Memory: 204.26 MB / 16.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 18.7.0 - ~/.nodenv/shims/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 8.17.0 - ~/Coding/histoire-demo/node_modules/.bin/npm
  Browsers:
    Firefox: 104.0
    Firefox Developer Edition: 104.0
    Safari: 15.6.1
  npmPackages:
    @histoire/plugin-vue2: 0.10.7 => 0.10.7 
    @vitejs/plugin-vue2: 1.1.2 => 1.1.2 
    histoire: 0.10.7 => 0.10.7 
    vite: 3.0.9 => 3.0.9

Used Package Manager

npm

Validations

@minddust minddust added the to triage This issue needs to be triaged label Aug 24, 2022
@minddust minddust changed the title Global story controls not working not working for vue2 Global story controls not working for vue2 Aug 24, 2022
@murongg
Copy link

murongg commented Aug 26, 2022

I found that Story #controls slot will be override Variant #controls slot!

The Variant #controls slot higher priority! When Variant #controls has content, Story #controls slot will not render !

But I prefer that Story #controls slot and Variant #controls slot can be merged !
@Akryum

see: https://histoire.dev/guide/vue2/controls.html#controls-panel

image

@minddust
Copy link
Author

@murongg that would be a feature request.

What I meant is that story controls are simply not working (at all) for vue2.

@iohansson
Copy link

in plugin-vue2 RenderStory.ts line 114

const vnodes = props.variant.slots()?.[props.slotName]?.({
  state: externalState,
}) ?? props.story.slots()?.[props.slotName]?.({
  state: externalState,
})

here props.story.slots().controls is not a function but an array of vnodes

@iohansson
Copy link

probably, because in Variant slots are proxy.$scopedSlots, and in Story slots are proxy.$slots

@iohansson
Copy link

yep, just changed it directly in the bundled dist and tried, I can see the global controls

@Akryum Akryum added bug Something isn't working vue2 and removed to triage This issue needs to be triaged labels Dec 19, 2022
@Akryum Akryum self-assigned this Dec 19, 2022
@Akryum Akryum closed this as completed in 2210c51 Dec 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working vue2
Projects
None yet
Development

No branches or pull requests

4 participants