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

createIf doesn't update #257

Open
xiaodong2008 opened this issue Jun 24, 2024 · 2 comments
Open

createIf doesn't update #257

xiaodong2008 opened this issue Jun 24, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@xiaodong2008
Copy link
Collaborator

createIf only updates when passing a context ref.

const value = ref(true)
const Parent = {
  render() {
    return createComponent(Child)
  },
}
const Child: Component = {
+ setup() {
+   return { value }
+ },
  render(_ctx) {
    return createIf(() => _ctx.value, template(`<div>`), template(`<span>`))
  },
}
const { html, serialize } = define(Parent).render()
value.value = false
await nextTick()
console.log(html()) // Doesn't change when without setup
@xiaodong2008 xiaodong2008 added pending bug Something isn't working and removed pending labels Jun 24, 2024
@GaoNeng-wWw
Copy link
Contributor

Snipaste_2024-06-26_10-59-50

It doesn't look like bug

git commit: 5eb43b08

@xiaodong2008
Copy link
Collaborator Author

xiaodong2008 commented Jul 1, 2024

Snipaste_2024-06-26_10-59-50

It doesn't look like bug

git commit: 5eb43b08

Reproduce:

const value = ref(true)
const Parent = {
  render() {
    return createComponent(Child)
  },
}
const Child: Component = {
  render() {
    return createIf(() => value, template(`<div>`), template(`<span>`))
  },
}
const { html, serialize } = define(Parent).render()
value.value = false
await nextTick()
console.log(html()) // Doesn't change when without setup

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