fake-news-chrome-extension icon indicating copy to clipboard operation
fake-news-chrome-extension copied to clipboard

Error when trying to set a Layer's props.id to a variable

Open kengreim opened this issue 1 month ago • 0 comments

I get an error (Uncaught TypeError: setting getter-only property "id") with this sample code:

<Show when={typeof map.getter() != "undefined"}>
  <Layer
    id={map.name}
    style={{
      "source-layer": map.sourceLayer,
      type: "line",
    }}
    visible={map.getter()}
  />
</Show>

I do not get an error with something like <Layer id="STRING"...

It may be due to settings props.id on this line instead of creating a different id variable that is then used for the rest of the component? Similar to what is done for sourceId in the line above it. https://github.com/GIShub4/solid-map-gl/blob/72b46e81b09a0bae10f52155c2e4f9258ccdffef/src/components/Layer/index.tsx#L95

kengreim avatar May 15 '24 22:05 kengreim