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

v-bind in CSS for async component not applied #8520

Closed
halsandr opened this issue Jun 8, 2023 · 1 comment · Fixed by #8523
Closed

v-bind in CSS for async component not applied #8520

halsandr opened this issue Jun 8, 2023 · 1 comment · Fixed by #8523
Labels
🔨 p3-minor-bug Priority 3: this fixes a bug, but is an edge case that only affects very specific usage. scope: suspense

Comments

@halsandr
Copy link

halsandr commented Jun 8, 2023

Vue version

3.3.4

Link to minimal reproduction

https://play.vuejs.org/#eNqVU8GO2jAQ/RXLF4IENuq2lzSgbQ89V6JHX0IyLN4mtmU7YRHi33diJyELWqQ9RPJ4nt+8PD+f6S9jWNsATWnmCiuNJw58YzZCESJro60nZwv7C9lbXZMZQmc/J7369LvxXqu+zXgsO8qI675CK+fJUZb+QNYE2RJBv61W5k3Q+Q3IHfTxj7S4isB9XjmIoCtgC7gu7xFXVAlVfkKAgiP5i8qkgySx4HTVwpysN+TcYUn3r/9kDbrxQ3dBfqxWke4yH0gDHfMHUEny4figlrV51QAO9LaBcDg2o9L7bked8Wg4Wo2Fh9pUuYdgfLZtnAHlYoV1Kdt+icXoebuU+7WgowpBSRpcXkev+fXMzj4+H4V+RpDxQUDGJ9IyPqqmCxoTsaxzw16dVpio4JLoG07QdPBNUMxHVwt68N64lPNGmf8vrNA1f8Yet43yeDHLUtfPT+yJfUcFzk+3Gbh6ubP66MDiQEEXE26Omy3YpQVVggX7cNYNdjrvpnU3M9ylUBf8/WvwH76lEvZSAWbSuOmbwgz4GF3TtTArE2DS2zYLtzJLydZbqV5ikL6Q/AU+mFco/BdewMieH3PZs+Peo+zuYriKKncO0zWkTdA+TB5QZgTFRMX1xzwFXudPFRBXaANlOMzG6PbqgyEpBnknVZkE61jY6/UHpR3Lhl7eAasGqXg=

Steps to reproduce

The issue is apparent in the repro (the buttons are different widths).

The important points to reproduce this are; an async component using v-bind in CSS must be hidden by v-if="false" in a parent, when the component is then shown, the CSS variable is not applied.

What is expected?

The buttons should both have a 200px width applied.

What is actually happening?

Only the first button has the 200px width applied.

System Info

No response

Any additional comments?

No response

@yyx990803 yyx990803 added scope: suspense 🔨 p3-minor-bug Priority 3: this fixes a bug, but is an edge case that only affects very specific usage. labels Jun 8, 2023
@Mosharush
Copy link

Hello,

I am writing to inquire about any updates on this issue. It appears that the associated Pull Request is ready for review.

Additionally, I have found a potential bug use case for this issue, which can be viewed here.

Here is the code for reference:

<template>
  <div class="card" :style="`--title-color: ${titleColor};`">
    <h1>Test v-bind vs manual handle CSS vars</h1>
    <p>Background color: {{ bgColor }}</p>
    <p>Title color: {{ titleColor }}</p>
  </div>
</template>

<script setup>
const bgColor = "red";
const titleColor = "blue";
</script>

<style>
.card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  background-color: v-bind(bgColor);
}

h1 {
  color: var(--title-color);
}
</style>

Expected Behavior

The div with the class card should have a red background due to the v-bind directive on the background-color property in the style section. Furthermore, the h1 title's text color should be blue because of the CSS variable (--title-color) binding.

Current Behavior

At present, only the CSS variable binding is functioning as expected, with the h1 title appearing in blue. The v-bind directive does not seem to be applying correctly, as the div with the class card is not displaying the expected red background.

Best regards.

@github-actions github-actions bot locked and limited conversation to collaborators Apr 30, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
🔨 p3-minor-bug Priority 3: this fixes a bug, but is an edge case that only affects very specific usage. scope: suspense
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants