stellasia / neomap

A Neo4j Desktop application to visualize nodes with geographic attributes on a map.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

stellasia opened this issue · comments

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 ?

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

@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

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 1437bdd 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.