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

Props reactivness lost #314

Open
andreadisaro opened this issue Aug 28, 2024 · 6 comments
Open

Props reactivness lost #314

andreadisaro opened this issue Aug 28, 2024 · 6 comments

Comments

@andreadisaro
Copy link

andreadisaro commented Aug 28, 2024

Hi,
if you define a component like this:

<script setup>
import { ref } from 'vue'
const valid = ref(false)
</script>

<template>
  <div
    class="rounded justify-content-center d-flex"
    :class="{
      'bg-success': valid,
      'bg-danger': !valid,
    }"
    style="width: 25px; height: 25px"
  >
    <CIcon
      :icon="valid ? 'cil-check' : 'cil-x'"
      @click="valid = !valid"
      class="text-white my-auto"
    />
  </div>
</template>

You'll see that the icon won't change when you click on the icon itself, while the color (class bg-success or bg-danger) will change.
I'm afraid this behaviour is something that is showing in all of the components, but I don't have an evidence of that

Thank you

edit: created an even simplier test case

@andreadisaro
Copy link
Author

guys this is a serious problem that will prevent me (and I think everyone else...) from using the template, please tell me you're going to address it ASAP and I don't have to choose another template...

@mrholek
Copy link
Member

mrholek commented Aug 29, 2024

@andreadisaro, it's not a problem with the template. The icon prop on the CIcon component is not reactive, but I will check if we can improve it.

@andreadisaro
Copy link
Author

@andreadisaro, it's not a problem with the template. The icon prop on the CIcon component is not reactive, but I will check if we can improve it.

Lukasz, please let me know asap if this is feasible and doable on every prop of the components of the template quickly, otherwise I'll have to choose another template.
I'm sorry but there's no scenario I can think of where a prop in a vue component shouldn't be reactive, it's just not the way vue is intended to work...

@mrholek
Copy link
Member

mrholek commented Aug 29, 2024

@andreadisaro please update @coreui/icons-vue to 2.2.0

@andreadisaro
Copy link
Author

@mrholek thank you, it's working now. although I'm concerned that if I keep working on the template I will find other situations like this in other components... are you planning to fix the other components props as well?
thank you

Copy link

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions

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

No branches or pull requests

3 participants
@mrholek @andreadisaro and others