Freika/dawarich · warning
[Maps V2] Unknown entity type:
Error message
[Maps V2] Unknown entity type:
What it means
This console.warn fires in the Maps V2 info-display edit handler (handleEdit) when a clicked edit button carries a data-entity-type value that is neither "visit" nor "place". The handler dispatches modals purely off the button's dataset, so an absent or unrecognized data-entity-type silently no-ops with only a warning. It is a Stimulus dataset-contract violation between the popup template that renders the button and this switch statement.
Source
Thrown at app/javascript/controllers/maps/maplibre_controller.js:1787
}
/**
* Handle edit action from info display
*/
handleEdit(event) {
const button = event.currentTarget
const id = button.dataset.id
const entityType = button.dataset.entityType
switch (entityType) {
case "visit":
this.openVisitModal(id)
break
case "place":
this.openPlaceEditModal(id)
break
default:
console.warn("[Maps V2] Unknown entity type:", entityType)
}
}
/**
* Handle delete action from info display
*/
handleDelete(event) {
const button = event.currentTarget
const id = button.dataset.id
const entityType = button.dataset.entityType
switch (entityType) {
case "area":
this.deleteArea(id)
break
case "point":
this.deletePoint(id)
breakView on GitHub (pinned to 97fad417c5)
Solutions
- Inspect the clicked button in DevTools and confirm data-entity-type is present and exactly "visit" or "place"; fix the popup template that renders it (search for data-entity-type in the info-display/popup partials).
- If a legitimate new entity type was introduced, add its case to the switch in handleEdit (app/javascript/controllers/maps/maplibre_controller.js:1781) alongside visit/place.
- Rename the attribute consistently if it was misspelled in markup (dataset.entityType maps only to data-entity-type).
Example fix
// before (popup template) // <button data-id="<%= visit.id %>" data-action="click->maps--maplibre#handleEdit">Edit</button> // after // <button data-id="<%= visit.id %>" data-entity-type="visit" data-action="click->maps--maplibre#handleEdit">Edit</button>
Defensive patterns
Strategy: type-guard
Validate before calling
const EDITABLE_TYPES = new Set(["visit", "place"]) const ok = EDITABLE_TYPES.has(button.dataset.entityType)
Type guard
const isEditableEntityType = (t) => t === "visit" || t === "place"
Prevention
- Define the entity-type vocabulary in one shared constant and use it in both the popup template renderer and the switch statements.
- Render the data-entity-type attribute unconditionally in popup button templates.
- In the default case, log button.outerHTML to pinpoint the offending template immediately.
When it happens
Trigger: Clicking an Edit button in a map info popup where the template omitted data-entity-type, misspelled it (e.g. data-entity_type), or passed a type like "point"/"area" that handleEdit does not support (those belong to handleDelete's switch). Also reproduced when a new entity type is added to the popup renderer without extending this switch.
Common situations: Template refactors that drop or rename the dataset attribute; adding a new clickable entity (e.g. notes) to the info display without updating handleEdit; copy-pasting the delete button markup (area/point) into an edit slot; HAML/ERB conditionals that render the button without the attribute for some entity kinds.
Related errors
- [Maps V2] Unknown entity type for delete:
- [Realtime Controller] Points layer not found
- errorData.error || `Failed to ${isEdit ? "update" : "create"
- Failed to fetch points: ${response.statusText}
- Invalid tile coordinates
AI-assisted analysis of Freika/dawarich@97fad417c5 (2026-08-21).
Data as JSON: /api/errors/ec937cec3584987c.
Report an issue: GitHub.