Skip to content

Fix region-specific presets in Recently Used list (#11405)#11906

Open
Kayd-06 wants to merge 1 commit intoopenstreetmap:developfrom
Kayd-06:fix/issue-11405-recent-pr-resets-region-filtering
Open

Fix region-specific presets in Recently Used list (#11405)#11906
Kayd-06 wants to merge 1 commit intoopenstreetmap:developfrom
Kayd-06:fix/issue-11405-recent-pr-resets-region-filtering

Conversation

@Kayd-06
Copy link
Contributor

@Kayd-06 Kayd-06 commented Feb 22, 2026

Fixes #11405

Summary

Region-specific presets (e.g. motorway_link-US) could occupy slots in the
“Recently Used” list but not appear in the UI when editing in a location
where that preset variant was invalid.

Problem

presetIndex.defaults filtered presets by locationSet after selecting
recent presets. If a region-specific preset was invalid for the current
location, it was removed without attempting to replace it, which could
result in unused (“ghost”) slots in the Recently Used list.

Solution

Update presetIndex.defaults to:

  • Detect when a recently used preset is invalid in the current location
  • Attempt to replace it with a semantically equivalent base preset using matchTags
  • Ensure strict tag equivalence using isEqual (to avoid unintended preset switching)
  • Filter the collection after replacement

If no equivalent preset exists, the invalid regional preset is removed.

Tests

Added regression tests to test/spec/presets/index.js to verify:

  • Regional variants are returned in valid regions
  • Regional variants are replaced by their base preset outside their region
  • Invalid regional presets are removed if no equivalent exists

@matkoniecz
Copy link
Contributor

in which way, if any, it is superior to #11810 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

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

2 participants