stellasia / neomap

A Neo4j Desktop application to visualize nodes with geographic attributes on a map.
GNU General Public License v3.0
106 stars 13 forks source link

The new layer is created with the data from an existing layer #82

Closed stellasia closed 3 years ago

stellasia commented 3 years ago

This is very confusing, after creating a layer, I end up with:

Capture d’écran de 2020-11-29 11-02-11

I don't which layer is the "new" one. New layers should be created from the default layer configuration.

Hint: is that related to: https://github.com/stellasia/neomap/blob/master/src/components/Layer.js#L310 ?

stellasia commented 3 years ago

Maybe related: the "Delete" button does not appear.

nikita03565 commented 3 years ago

@stellasia is it about master_dev branch? if so it is easy to fix: new layer is created with a copy of current layer's state. we just need to replace it with default state

createLayer = async () => {
        await this.updateData();
        const proposedLayer = {...this.state};
        // Generate new ukey
        proposedLayer.ukey = generateUkeyFromName(proposedLayer.name);

        this.props.addLayer(proposedLayer);
    }

https://github.com/stellasia/neomap/blob/master_dev/src/components/Layer.js#L312

stellasia commented 3 years ago

That was a bit more complicated than that, actually new layer was created with a default "ukey", which was causing troubles used in combination with a useMemo hook (at least, this is my understanding). Fixed in https://github.com/stellasia/neomap/commit/1437bdd30297e3c924ff1b1cfc254d0410fe24d7 with several other bugs, such that master_dev is not in much better shape :) I'll do more tests this week and merge it with master over the week-end, so that we can restart working from there.