{"record":{"id":"7ccb32e66199bd3f","repo":"Freika/dawarich","slug":"familylayer-skipping-member-update-with-invalid","errorCode":null,"errorMessage":"[FamilyLayer] Skipping member update with invalid coordinates:","messagePattern":"\\[FamilyLayer\\] Skipping member update with invalid coordinates:","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"app/javascript/maps_maplibre/layers/family_layer.js","lineNumber":196,"sourceCode":"      this.id,\n      `${this.id}-labels`,\n      `${this.id}-pulse`,\n      `${this.id}-history`,\n    ]\n  }\n\n  /**\n   * Update single family member location\n   * @param {Object} member - { id, name, latitude, longitude, color }\n   */\n  updateMember(member) {\n    const features = this.data?.features || []\n    const memberId = member.user_id || member.id\n    const lon = Number(member.longitude)\n    const lat = Number(member.latitude)\n\n    if (!this._isValidCoord(lon, lat)) {\n      console.warn(\n        \"[FamilyLayer] Skipping member update with invalid coordinates:\",\n        member,\n      )\n      return\n    }\n\n    const coords = [lon, lat]\n    const color = member.color || this.getMemberColor(memberId)\n\n    // Find existing or add new\n    const index = features.findIndex((f) => f.properties.id === memberId)\n\n    const feature = {\n      type: \"Feature\",\n      geometry: {\n        type: \"Point\",\n        coordinates: coords,\n      },","sourceCodeStart":178,"sourceCodeEnd":214,"githubUrl":"https://github.com/Freika/dawarich/blob/97fad417c5a11b0eb11157890635e015723a2e97/app/javascript/maps_maplibre/layers/family_layer.js#L178-L214","documentation":"FamilyLayer.updateMember coerces member.longitude/latitude with Number() and rejects the update when _isValidCoord fails (non-finite or out-of-range values). The warn logs the whole member object, meaning the family-locations payload contained a member whose coordinates are null, undefined, non-numeric strings, or outside valid lon/lat ranges. That member's marker is skipped, others still render.","triggerScenarios":"A family_location ActionCable broadcast or /api family-locations fetch includes a member with null latitude/longitude (location sharing off, no data yet), string coordinates like \"51.1\\u00b0N\", or swapped/out-of-range values (lat > 90). Number(null) is 0 which may pass, but Number(undefined) is NaN which fails _isValidCoord.","commonSituations":"A family member disabled location sharing so the backend serializes nulls; new member with no points yet; third-party client uploading malformed coords; API schema change renaming lat/lon fields so both read as undefined.","solutions":["Inspect the logged member object to see which field is bad (usually null/undefined latitude or longitude).","Filter non-geocoded members server-side (skip serializing members without coordinates) or in the caller before updateMember is invoked.","If fields were renamed in the API payload, update the destructuring/property reads in family_layer.js to match (longitude/latitude keys)."],"exampleFix":"// before\nupdateMember(member) {\n  const lon = Number(member.longitude)\n  const lat = Number(member.latitude)\n  if (!this._isValidCoord(lon, lat)) { console.warn(...); return }\n  ...\n}\n\n// after (caller filters first)\nconst valid = (m) => Number.isFinite(+m.longitude) && Number.isFinite(+m.latitude)\nlocations.filter(valid).forEach((m) => familyLayer.updateMember(m))","handlingStrategy":"validation","validationCode":"const lon = Number(member.longitude)\nconst lat = Number(member.latitude)\nconst valid = Number.isFinite(lon) && Number.isFinite(lat) &&\n  lon >= -180 && lon <= 180 && lat >= -90 && lat <= 90","typeGuard":"const hasValidCoords = (m) =>\n  Number.isFinite(Number(m?.longitude)) &&\n  Number.isFinite(Number(m?.latitude))","tryCatchPattern":null,"preventionTips":["Filter members without finite in-range coordinates before calling updateMember.","Have the backend omit members with null coordinates instead of serializing them."],"tags":["maplibre","geo-coordinates","family-sharing","data-validation"],"backgroundTag":"invalid-coordinates","analyzedSha":"97fad417c5a11b0eb11157890635e015723a2e97","analyzedAt":"2026-08-21T17:04:17.778Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}