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

Temp vars via ":set" and _renderEffect order #270

Open
altrusl opened this issue Aug 20, 2024 · 1 comment
Open

Temp vars via ":set" and _renderEffect order #270

altrusl opened this issue Aug 20, 2024 · 1 comment

Comments

@altrusl
Copy link

altrusl commented Aug 20, 2024

Creation of temporary variable in v-for loops is not documented but in some cases is very helpful in Vue 2 and Vue 3:

  <p v-for="user in users" >
    <span :set="u = user">
    id: {{ u.id }}, name: {{u.name}}
    </span>
  </p>

In Vapor it is broken because of the order of _renderEffect's

    _renderEffect(() => _setText(n2, " id: ", _ctx.u.id, ", name: ", _ctx.u.name))
    _renderEffect(() => _setDynamicProp(n2, "set", _ctx.u = _ctx0[0]))

Sandbox

Shouldn't it be supported in the Vapor mode too?

@altrusl altrusl changed the title ":set" and _renderEffect order Temp vars via ":set" and _renderEffect order Aug 20, 2024
@altrusl
Copy link
Author

altrusl commented Aug 21, 2024

Regardless of the ":set" functionality - _setDynamicProp seems to be a pre-rendering step, shouldn't it be executed before _setText?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant