Skip to content

refactor(ui): scope SVG defs IDs without interpolating region.id #106

@comnam90

Description

@comnam90

Spun out of code review on #103 (item #6).

Context

`markerLogos.azure(uid)` builds an Azure provider glyph with several `<linearGradient id="azure_a_${uid}">` etc., using `region.id` as the unique ID per marker. Today `region.id` is lowercase-hyphenated by schema, so it works. But the contract is implicit — an ID with whitespace, `"`, or other unsafe chars would break the `` markup.

Proposed fix

Generate a monotonically-incrementing or hash-based UID inside the SVG factory itself rather than threading `region.id` through:

```js
let _uid = 0;
const nextUid = () => `m${(++_uid).toString(36)}`;
markerLogos.azure(nextUid())
```

Removes the dependency on caller-supplied data shape.

Acceptance

  • markerLogos.azure no longer requires region.id
  • SVG defs IDs are unique per marker
  • Markers render correctly across both providers

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions