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

Preview mode doesn't work with reactive state (only with the initState pattern) #90

Closed
hugoattal opened this issue May 10, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@hugoattal
Copy link
Collaborator

I believe the failed test from my PR #88 are due to me updating the state from this pattern

function initState () {
  return {
    text: 'Hello',
    checkbox: false,
    number: 20,
    longText: 'Longer text...',
    select: 'crash-bandicoot',
  }
}

to this pattern

const state = reactive({
  text: 'Hello',
  checkbox: false,
  number: 20,
  longText: 'Longer text...',
  select: 'crash-bandicoot',
})

I've reverted this and the test now pass. Note that everything works fine in dev mode.

@hugoattal hugoattal added the bug Something isn't working label May 10, 2022
@hugoattal hugoattal changed the title Preview mode don't work with reactive state (only with the initState pattern) Preview mode doesn't work with reactive state (only with the initState pattern) May 10, 2022
@Akryum
Copy link
Member

Akryum commented May 10, 2022

With script setup you need to use defineExpose so that Histoire can access the state in production.

@Akryum Akryum closed this as completed May 10, 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
Projects
None yet
Development

No branches or pull requests

2 participants