Skip to content

Prevent unused slots in the recent preset list.#11810

Merged
tyrasd merged 2 commits intoopenstreetmap:developfrom
Razen04:recent-preset-fix
Mar 19, 2026
Merged

Prevent unused slots in the recent preset list.#11810
tyrasd merged 2 commits intoopenstreetmap:developfrom
Razen04:recent-preset-fix

Conversation

@Razen04
Copy link
Copy Markdown
Contributor

@Razen04 Razen04 commented Jan 25, 2026

Fixes #11405

Filtering before slicing prevents the unused slots in the recent preset list, more detail about this in #11405

If we wish to show the Motorway Link and others in the US and CA in the recent list, we can just prevent filtering the recent list based on location, I have already commented in the issue everything here.

@matkoniecz
Copy link
Copy Markdown
Contributor

matkoniecz commented Feb 26, 2026

Can you add test so potential regression would be avoided?

@Razen04
Copy link
Copy Markdown
Contributor Author

Razen04 commented Mar 1, 2026

Sure, I will do it rn.

@Razen04
Copy link
Copy Markdown
Contributor Author

Razen04 commented Mar 1, 2026

It's really weird that Github gave attribute to some random account, I am trying to fix the commits because it contained my personal name which I don't wish to have. But Github attributed the commits to someone random person, I think I fixed it for now.

Anyways I have added the test case, never done before so maybe it is wrong do let me know that.

Copy link
Copy Markdown
Contributor

@matkoniecz matkoniecz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when you select "motorway link" from major roads folder it will not appear in recent presets

yes, it is no longer blocking history slot but it is still a bug

@Razen04
Copy link
Copy Markdown
Contributor Author

Razen04 commented Mar 3, 2026

That is what's supposed to happen if we are in US or maybe CA too, OSM prevents those from appearing. I think it is intentionally done

@matkoniecz
Copy link
Copy Markdown
Contributor

matkoniecz commented Mar 3, 2026

no, it is also clearly part of the same bug and unwanted behavior resulting from overcomplex area-specific presets

@Razen04
Copy link
Copy Markdown
Contributor Author

Razen04 commented Mar 3, 2026

Ohhh, I thought that was intentional, fine then I will just make it not check the location maybe and bypass that. But then why is the data containing that, as mentioned in the issue by me?

@matkoniecz
Copy link
Copy Markdown
Contributor

randomly hiding motorway link from recently used entries is definitely not deliberate

it is side effect of having special motorway link entry for USA, maybe also other areas (which was well intentioned solution for some other problem but causing trouble due to increased complexity)

@matkoniecz
Copy link
Copy Markdown
Contributor

Looking at it again: does NOT entirely fix linked issue, but should work for cases where user edited one area then moved to another. So worth merging anyway, I guess?

Comment thread modules/presets/index.js Outdated
// filtering before slicing to prevent unused slots in the recent preset list, issue #11405
recents = _this.recent().matchGeometry(geometry).collection
.filter(a => !a.locationSetID || validHere[a.locationSetID])
.slice(0, 4);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we changed how many recent presets are listed from 4 to defined constant and this code also should use it now

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see #9545

@ Razen04 can you please rebase this branch to the latest development branch?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Razen04 fixed ping

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah let me do it

@Razen04 Razen04 force-pushed the recent-preset-fix branch from 55c4a55 to 804e228 Compare March 16, 2026 13:37
@Razen04
Copy link
Copy Markdown
Contributor Author

Razen04 commented Mar 16, 2026

I have updated the code to work with MAX_RECENTS_TO_SHOW and also rebased it.

Copy link
Copy Markdown
Contributor

@matkoniecz matkoniecz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

confirmed that it works

having motorway link from folder eats you one history entry in iD version on osm.org, not here

BTW, I created #12044 as this problem is a bit wider, so #11405 can be closed

@matkoniecz
Copy link
Copy Markdown
Contributor

alternative fix would be to magically replace US-trunk link by regular trunk link and vice versa, but there is no reasonable way to achieve this and may be confusing

admittedly, disappearing trunk link is also confusing (this PR fixes not disappearance but failing to use one of recent entries slots)

@tyrasd tyrasd added the bug A bug - let's fix this! label Mar 19, 2026
@tyrasd tyrasd merged commit dce4f99 into openstreetmap:develop Mar 19, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug A bug - let's fix this!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Presets for motorway link, trunk link, primary link won’t show up as recently used presets in some regions

3 participants