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

confusing behaviour with v-if and alreadyRendered #15

Closed
k3ssen opened this issue Apr 24, 2021 · 1 comment
Closed

confusing behaviour with v-if and alreadyRendered #15

k3ssen opened this issue Apr 24, 2021 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@k3ssen
Copy link
Owner

k3ssen commented Apr 24, 2021

Example code:

    <sv-form :form="{{ form | vue }}" v-if="{{ false | vue('showForm') }}"></sv-form>
    <v-btn @click="showForm = !showForm">Show/hide form</v-btn>

When you click 'show/hide form', then the form will be removed because of the 'v-if'. When clicking the button again, the form should re-appear, but this won't happen, because of the 'alreadyRendered' that is set in the form-object(s).

Some alterations are needed to allow re-enabling the form. Probably something like vue's 'destroyed' might be useful to undo the 'alreadyRendered', but maybe there are some better alternatives as the 'v-if' en 'alreadyRendered' can cause other problems as well.

@k3ssen k3ssen self-assigned this Apr 24, 2021
@k3ssen
Copy link
Owner Author

k3ssen commented Apr 25, 2021

I'm not sure yet about alternatives; Using v-if with form-rendering seems to be a bad idea to begin with, since the fields may be required by Symfony's form. It'd be beter to use v-show.

This particular issue is now fixed by using this.resetRendered(this.form); in destroyed method

@k3ssen k3ssen closed this as completed Apr 25, 2021
@k3ssen k3ssen added the bug Something isn't working label Apr 25, 2021
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

1 participant