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

Not working when schema and data changes #58

Open
flaviocordova opened this issue Dec 10, 2019 · 10 comments
Open

Not working when schema and data changes #58

flaviocordova opened this issue Dec 10, 2019 · 10 comments

Comments

@flaviocordova
Copy link

if you change both schema and data, fields are rendered properly but data is not shown (all fields show empty value).

Check this codepen: https://codepen.io/fcordova/pen/GRgZmRz

If you first click 'LOAD DATA 1' form is shown perfectly, but once you click 'form data 2' the form is rendered empty. If you reload the page and begin with data 2, it's also rendered fine but then data 1 can't be rendered anymore.

@nickjfree
Copy link

same issue.
have you solve the problem? @flaviocordova

@flaviocordova
Copy link
Author

Nope, I guess it'll require a fix, no?

@albanm
Copy link
Member

albanm commented Feb 12, 2020

I will try to make it work in upcoming major version. But I don't want to spend too much time on current version. Can this be solved with a v-if to destroy / recreate the form when the schema changes ?

@nickjfree
Copy link

Recreating the form with v-if works.:)

@OdiljonQurbon
Copy link

Recreating the form with v-if works.:)

@nickjfree could you update Codepen with your solutions?

@nickjfree
Copy link

https://codepen.io/nickjfree/pen/gOpPXpj

@OdiljonQurbon
Copy link

https://codepen.io/nickjfree/pen/gOpPXpj

Cool, thank you @nickjfree !

@ghost
Copy link

ghost commented Jul 10, 2020

@nickjfree if I use your workaround but mix it with a keep-alive component, the result is really bad performance (event binding memory leak maybe?) and strange things appear to happen with inputs where the input loses focus after I type one time.

There's a chance this is specific to my code but I'm wondering if there is a better way for this to be done? Maybe for the form to properly watch the model and update accordingly.

I will need this functionality to behave properly in the relatively near future so if there is no additional work-around or work being done here, I may start on a PR, although I may need a nudge in the right direction from you @albanm.

@albanm
Copy link
Member

albanm commented Jul 28, 2020

I tried to look into this a little, but I didn't reach a working solution and reactivity subtleties were giving me headaches. I think even if I were to improve things, perfectly reacting to external changes of both schema and model will never be guaranteed by this library. I strongly suggest working on your side.

@uaru
Copy link

uaru commented Jan 30, 2023

I had very similar issue. When the whole value of model is replaced, the form is not updated.
I wanted to cycle through a list of forms by replacing the v-model - it did not work.

The trick with v-if works for me, too.

Instead of v-if it is possible to use :key either on the component or on the form.

<v-jsf :key="nextkey">

This way it is not needed to use this $nextTick function.

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

5 participants