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

Relations isn't working as expected #1103

Closed
gyCfjSnO opened this issue Sep 6, 2023 · 6 comments
Closed

Relations isn't working as expected #1103

gyCfjSnO opened this issue Sep 6, 2023 · 6 comments
Assignees
Labels
bug Something isn't working top-priority Top priority issue
Milestone

Comments

@gyCfjSnO
Copy link

gyCfjSnO commented Sep 6, 2023

Description

Creating a relation isn't working as expected.

Relations.isn.t.working.as.expected.mp4

Version

2.1.1

What browser are you seeing the problem on? What version are you running?

Edge v116.0

The OS you're using

win

Steps to reproduce

No response

The browser URL at the time you encountered the bug

https://rapideditor.org/edit#background=EsriWorldImagery&disable_features=boundaries&map=20.48/-27.32747/152.98192

The auto-detected useragent string for your browser (leave blank if you're manually filling this form out)

Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36 Edg/116.0.1938.69

@bhousel
Copy link
Contributor

bhousel commented Sep 6, 2023

Could be something like #1084, but for the relation editing instead of the tag editing 🤔

@bhousel bhousel added bug Something isn't working top-priority Top priority issue labels Sep 6, 2023
@Bonkles Bonkles self-assigned this Sep 7, 2023
@Bonkles
Copy link
Contributor

Bonkles commented Sep 7, 2023

This could also be related to my fix for #972, which just released in 2.1. Taking a look now.

@Bonkles
Copy link
Contributor

Bonkles commented Sep 7, 2023

Successfully reproduced the issue- and found something peculiar.

The user-provided video of the issue (which was excellent, thank you for including that @gyCfjSnO) shows very clearly that, at the moment of creating the relation on the building boundary, once the entity editor is clicked off of, the # of changes goes backwards. This would seem to indicate that we are actually backing the edit history up, which means we never actually create the relation. This seems to explain why the relation dropdown won't 'see' the edit in the final step.

@Bonkles
Copy link
Contributor

Bonkles commented Sep 7, 2023

Root cause found!

In the select code, when the user deselects a relation, we evaluate whether the relation is 'empty'. This is to prevent people who are clicking around on stuff from creating relations that have no roles / point to nothing.

As such, we have a very big check in the select code that goes like this:

'If we stop selecting a relation, and the relation has no tags, and no parent relations, and no members at all or exactly one member with no role, delete the relation.'
This code should never have evaluated to true, so the relation shouldn't have been deleted. So what went wrong?

What went wrong was we were using a stale reference to the relation- the relation as it was during creation had no tags and no role. Even after the user selected the 'role:outline', the _singularData member of the SelectOsm class was stale.

Solution was to call context.hasEntity to get the most up-to-date version of the relation, and check against THAT.

@Bonkles Bonkles closed this as completed in 8cb7599 Sep 7, 2023
@Bonkles
Copy link
Contributor

Bonkles commented Sep 7, 2023

Should release as part of the 2.1.2 (or greater) code drop.

@gyCfjSnO
Copy link
Author

gyCfjSnO commented Sep 7, 2023

Thank you for your prompt action @Bonkles @bhousel 🤗

@Bonkles Bonkles added this to the v2.2 milestone Nov 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working top-priority Top priority issue
Projects
None yet
Development

No branches or pull requests

3 participants