-
Notifications
You must be signed in to change notification settings - Fork 41
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
OL layer properties are no longer reactive #365
Comments
Hi @fschmenger, I tried to have a look at this one and arrive at the same results as you for now... To give some more details of what I saw, if you install dependencies on Wegue v1.2.1 then remove package-lock.json and try to recreate it, the problem doesn't happen neither. You have to recreate the package-lock.json with an empty node_modules directory for the problem to occur. In this situation, the number of changed dependencies is so big that tracking what could induce this could potentially take ages... Another funny thing is that when you reproduce the bug with the drag and drop as you explained, the name is correctly regenerated once you hide or show the layer by clicking on the chekbox next to the name... then if you switch languages again, you once again have to hide or show it for the name to be regenerated... I tried rewriting the Last thing I saw is that if I force the measure layer to appear in the layers list (OlMeasureController.js line 47), it has the same problem, the name doesn't change when languages are switched. This one is created afterwards in a I'm not sure this comment will help and I must admit I have no real clue on what happens here for now... I'll keep it in my head though and will come back to it if something comes up in my mind... |
Hi @sronveaux, A good starting point could be to look in the OpenLayers property management which is handled inside BaseObject. My first guess was, that under the given circumstaces a new instance of the property object managed inside Maybe it`s also interesting to use one of the debugging options in https://vuejs.org/guide/extras/reactivity-in-depth.html?! |
I finally understood the source of the problem. From the aforementionened Change-Detection-Caveats:
The cause is obviously that we're adding the To check the difference, e.g. add a This is overall quite unfortunate. I can only assume it worked in an older version, because the Now we have to think about a solution :/ |
Hi @fschmenger, Good job, that's exactly it ! Well, at least we have a quick and dirty hack to make it work as expected if this is of importance inside a given project... how to do it in a clean way is something else... as you said, let's think about a solution... :/ |
Hi @sronveaux, I'm currently working on a draft based on proxy objects which would wrap up OL layers (and layer collections). The layer proxy will just override the Even though I probably won't have time to finish it by now, I will post a first draft later on, so you can have a look at it. |
Hi team, As I promised in #411 here are some things I saw and tried on this subject while upgrading to First of all, the situation in I thought a nice trick was to create a reactive layer collection inside the Unfortunately, there is another drawback that is well explained in Vue documentation. Comparing a reactive object to the original one is not (easily) possible anymore as you compare the Those results are relatively new in my mind so I don't know how to go further from here... one way could be to fully test what you did in #368 to be sure it doesn't break some other |
Hi @sronveaux, I'll be off for vacation for the next 3 weeks, so don`t expect any feedback in the meantime :) |
Hi @fschmenger and thanks for the fast reply ! Same for me, I wanted to share all my latest work before my summer break... so don't worry, I won't delve more into this for the next weeks neither ;-) Cheers, |
It seems that lately vue-bindings to
layer.getProperties()
or via thelayer.get('someProperty')
will not get updated. Particularly puzzling is, that it seems to work for all layers added in the 1st generation, i.e. those configured statically in app.conf but not for those added dynamically in a later cycle.To see an example: Create a drag drop layer (e.g. download GeoJSON from https://openlayers.org/en/latest/examples/drag-and-drop.html) and open the layer list module. Then switch the active language. The drag drop layer is localized and supposed to switch its language, however only the "static" wegue layers will receive the update.
The related code in
LayerListItem
looks likeNeither does it work via
getProperties()
if you alter the code above toor by using explicit computed properties, etc.
Note that some other components, i.e. the AttributeTable will still update the layer name. This is just a happy circumstance because they use other localized attributes in the same block, causing the whole thing to re-render.
Trying to track it down I rolled Wegue all the way back to v1.2.1 to finally see it working. However, if I delete the package-lock.json and do a full reinstall of dependencies, then the functionality is broken even back then.
A workaround could be to register for layer
propertychange
events and then manage our own binding targets, e.g.We used to have something like this in a very old version of Wegue but it would be cumbersome to reintroduce it and hunt down all code blocks where a binding to layer properties occurs.
Any ideas on the underlying cause and what to do about it?
The text was updated successfully, but these errors were encountered: