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

Reactivity issue on slots #33

Closed
rhmkstk opened this issue May 10, 2023 · 2 comments · Fixed by #51
Closed

Reactivity issue on slots #33

rhmkstk opened this issue May 10, 2023 · 2 comments · Fixed by #51
Labels
bug Something isn't working

Comments

@rhmkstk
Copy link
Collaborator

rhmkstk commented May 10, 2023

Describe the bug

If we render a slot conditionaly root component can not react the changes, because of the slots are not reactive in vuejs.

<lui-button @click="tooggleIcon = !tooggleIcon">My Button
    <template v-if="tooggleIcon" #append> <i  class="ri-arrow-up-line"/></template>
</lui-button>

If we want to toogle the icon like above examle, button does not add the necessary class for append slots.

What version of do you have in package.json?

0.63.6

If possible, please include a link to a codesandbox with the reproduced problem

No response

Do you know how to fix the issue

No

Are you willing to participate in fixing this issue and create a pull request with the fix

Yes

Possible fix

Slots should be reactive be able to fix this issue, we need to find a way make them reactive.

@rhmkstk rhmkstk added the bug Something isn't working label May 10, 2023
@ABB65
Copy link
Contributor

ABB65 commented May 12, 2023

@rhmkstk Can the code Here solve our problem?
Also, this issue may have been resolved in April with the issue here ?

@rhmkstk
Copy link
Collaborator Author

rhmkstk commented May 15, 2023

@ABB65 Issue that you provide similar to our issue but they are not same. The code that you provide use a custom component to render slots, and reads the content of the slots. Wee need the know if there is a slot or not. We do not need to know contents of the slots.

I believe that i found a very basic way to solve issue. If we check in the template whether there is a slot or not, we can react, because vue re-render the component when you toogle component.I will test and commit changes.

rhmkstk added a commit that referenced this issue May 16, 2023
There are some classes apply the button when slots exist, because of slots are not reactivy we could
not toogle this class when slots toogle with v-if.Fix this issue my moving this classes to template,
because of vue re-render the component when slots toogle we can apply the classes

#33
@rhmkstk rhmkstk linked a pull request May 16, 2023 that will close this issue
3 tasks
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

Successfully merging a pull request may close this issue.

2 participants