ghettovoice/vuelayers

How to revert feature modification when features are computed prop

niklashaa opened this issue · 2 comments

Hi,
I'm trying to find a way to revert changes done with the modify interaction.
My features are currently a computed prop as shown here in this jsFiddle where the data for the features usually comes from vuex.
After modifying the features the shown features are obviously different from the ones stored in the computed prop.
Is there a simple way to restore the map to only showing the features that are stored in the computed prop?

My guess is that there might be a way to refresh the vector source or
there is a revert function I'm unable to find.

Hello @niklashaa ,
you can achieve rollback with the help of additional computed prop that return origin features or current modified features.
There is updated fiddle https://jsfiddle.net/ghettovoice/wark5vh3/12/.

Thanks a lot!
I found another way by giving vl-source-vector a key which I updated on reset. Vue would then re-render it with the unedited features.
Unfortunately the performance was kind of laggy.
Your solution is far better.