{"record":{"id":"158799aa4ff167df","repo":"Freika/dawarich","slug":"maps-v2-search-targets-not-found-search-functio","errorCode":null,"errorMessage":"[Maps V2] Search targets not found, search functionality disabled","messagePattern":"\\[Maps V2\\] Search targets not found, search functionality disabled","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"app/javascript/controllers/maps/maplibre_controller.js","lineNumber":430,"sourceCode":"\n    this.map = map\n    this._persistView = () => saveView(this.map, this.apiKeyValue)\n    this.map.on(\"moveend\", this._persistView)\n  }\n\n  /**\n   * Initialize API client\n   */\n  initializeAPI() {\n    this.api = new ApiClient(this.apiKeyValue, this.importIdValue || null)\n  }\n\n  /**\n   * Initialize location search\n   */\n  initializeSearch() {\n    if (!this.hasSearchInputTarget || !this.hasSearchResultsTarget) {\n      console.warn(\n        \"[Maps V2] Search targets not found, search functionality disabled\",\n      )\n      return\n    }\n\n    this.searchManager = new SearchManager(this.map, this.apiKeyValue)\n    this.searchManager.initialize(\n      this.searchInputTarget,\n      this.searchResultsTarget,\n    )\n  }\n\n  /**\n   * Load map data from API\n   */\n  async loadMapData(options = {}) {\n    return this.mapDataManager.loadMapData(\n      this.startDateValue,","sourceCodeStart":412,"sourceCodeEnd":448,"githubUrl":"https://github.com/Freika/dawarich/blob/97fad417c5a11b0eb11157890635e015723a2e97/app/javascript/controllers/maps/maplibre_controller.js#L412-L448","documentation":"The Maps v2 Stimulus controller wires location search only when both Stimulus targets — searchInput and searchResults — exist within its DOM scope. If either data-maps--maplibre-target attribute is missing (element omitted from the view, target renamed, or markup placed outside the data-controller element), search is silently disabled with this warning and the rest of the map works normally.","triggerScenarios":"The search partial not rendered (feature flag off or a template variant without it); the target attribute typo'd or wrongly cased in markup; the elements present but outside the element carrying data-controller; cached old markup lingering after a rename.","commonSituations":"Custom themes overriding the map view without the search markup; upgrades renaming targets while Turbo/CDN caches serve stale HTML; layout changes nesting the search input in a different controller scope.","solutions":["Inspect the map element's DOM: both data-maps--maplibre-target=\"searchInput\" and data-maps--maplibre-target=\"searchResults\" must exist inside the data-controller element","Fix typos and casing in the target attribute values — they must match the controller's target names exactly","If search is intentionally omitted, gate initializeSearch on a feature flag instead of relying on missing markup","Clear Turbo caches and CDN HTML after target renames so stale markup disappears"],"exampleFix":"<!-- before -->\n<div data-controller=\"maps--maplibre\">\n  <input type=\"search\" id=\"q\"> <!-- no target attribute -->\n</div>\n<!-- after -->\n<div data-controller=\"maps--maplibre\">\n  <input type=\"search\" data-maps--maplibre-target=\"searchInput\">\n  <ul data-maps--maplibre-target=\"searchResults\"></ul>\n</div>","handlingStrategy":"validation","validationCode":"const input = this.element.querySelector('[data-maps--maplibre-target=\"searchInput\"]')\nconst results = this.element.querySelector('[data-maps--maplibre-target=\"searchResults\"]')\nif (!input || !results) {\n  this.hideSearchAffordance() // keep the UI honest instead of a dead input\n  return\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep target names as constants shared between markup helpers and the Stimulus controller","Feature-gate the search UI in markup rather than relying on runtime-absence warnings","After renames, expire Turbo caches and CDN HTML so stale markup without targets disappears"],"tags":["stimulus","targets","dawarich","search","dom"],"backgroundTag":"stimulus-target-missing","analyzedSha":"97fad417c5a11b0eb11157890635e015723a2e97","analyzedAt":"2026-08-21T17:04:17.778Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}