Skip to content

Navigation Menu

Sign in
Sign up

Fix: changing node type to "Climbing Area" — HTTP 500, wrong tags, broken re-detection - #54

Draft
jvaclavik with Copilot wants to merge 2 commits into
master from
copilot/change-node-type-to-climbing-area
Draft

Fix: changing node type to "Climbing Area" — HTTP 500, wrong tags, broken re-detection #54
jvaclavik with Copilot wants to merge 2 commits into
master from
copilot/change-node-type-to-climbing-area

Conversation

Copilot AI commented Jun 8, 2026
edited
Loading

Copy link
Copy Markdown
Contributor

Three bugs when selecting "Climbing Area" from PresetSelect on a node: duplicate sport=climbing caused HTTP 500 on OSM API save; relation-only tags type=site / site=climbing were applied to nodes; and re-opening the saved node showed "Select the type" because findPreset couldn't match it (the relation preset requires type=site which nodes never have).

Changes

  • ourPresets.ts — add a dedicated climbing/area node preset:

    • tags: { climbing: 'area' } — matchable by findPreset on nodes (fixes re-detection)
    • addTags: { climbing: 'area', sport: 'climbing' } — no type=site / site=climbing (fixes wrong tags)
    • geometry: ['point']
    • Remove the old type/site/climbing/area .geometry.push('point') hack that was leaking the relation preset into node editing
  • useOptions.tsx — replace 'type/site/climbing/area' with 'climbing/area' in EMPTY_OPTIONS so the correct node preset appears in the dropdown

  • PresetMenu.tsx — deduplicate tags on preset change: any key already in toAdd is now stripped from prev before merging, preventing the duplicate sport=climbing that caused the 500:

const toAddKeys = new Set(toAdd.map(([key]) => key));
prev.filter(([key, value]) =>
 !toAddKeys.has(key) && !(toRemove[key] && toRemove[key] === value)
)

Screenshots

Before fix (node shows "Select the type" after save):

Checklist

  • dark mode / light mode
  • mobile / desktop
  • server-side-rendering (SSR)
  • all texts are localized (in vocabulary.ts)

vercel Bot commented Jun 8, 2026
edited
Loading

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
openclimbing-preview Ready Ready Preview Jun 8, 2026 8:27pm

..., correct preset detection
- Add `climbing/area` node preset in ourPresets.ts with tags {climbing:'area'} and
 addTags {climbing:'area', sport:'climbing'} — valid for nodes only
- Remove `type/site/climbing/area` geometry.push('point') hack; the relation preset
 now stays relation-only so its type=site / site=climbing tags are never applied to nodes
- Replace 'type/site/climbing/area' with 'climbing/area' in EMPTY_OPTIONS (useOptions.tsx)
 so the correct node preset is shown in the preset-change dropdown
- Deduplicate tags in PresetMenu.tsx: filter `prev` entries whose key is in `toAdd`,
 preventing duplicate sport=climbing (which caused HTTP 500 on OSM API save)
Copilot AI changed the title (削除) [WIP] Fix 500 error when changing node type to Climbing Area (削除ここまで) (追記) Fix: changing node type to "Climbing Area" — HTTP 500, wrong tags, broken re-detection (追記ここまで) Jun 8, 2026
Copilot AI requested a review from jvaclavik June 8, 2026 20:25

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes several issues when switching a node’s preset to "Climbing Area" in the edit dialog by introducing a node-specific preset, correcting the preset key used in the dropdown defaults, and preventing duplicate tags during preset changes.

Changes:

  • Add a dedicated node preset climbing/area (with node-valid tags) and translation so findPreset can re-detect it correctly.
  • Update preset dropdown defaults for openclimbing to use climbing/area instead of the relation preset key.
  • Prevent duplicate tag keys when applying a new preset’s addTags/tags, avoiding invalid duplicate entries (e.g., sport=climbing twice).

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
src/services/tagging/ourPresets.ts Adds a node-only climbing/area preset (and translation) and injects it into the preset set; removes the prior "relation preset geometry hack".
src/components/FeaturePanel/EditDialog/EditContent/FeatureEditSection/PresetSelect/useOptions.tsx Updates openclimbing’s empty preset options to reference the new climbing/area preset key.
src/components/FeaturePanel/EditDialog/EditContent/FeatureEditSection/PresetSelect/PresetMenu.tsx Deduplicates existing tags by key when switching presets to prevent duplicate tag entries on save.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@@ -1,4 +1,4 @@
import { Presets } from './types/Presets';
import { Presets, RawPresets } from './types/Presets';

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.

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

Reviewers

Copilot code review Copilot
Copilot review effort, defaults to Lite
Applies to this pull request for everyone.Learn more about Copilot code review.
Copilot left review comments
@jvaclavik jvaclavik Awaiting requested review from jvaclavik

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Changing node type to "Climbing Area" fails with 500

3 participants

AltStyle によって変換されたページ (->オリジナル) /