Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using createStratumInstance with traits which have nested objectTraits #4727

Closed
nf-s opened this issue Sep 9, 2020 · 1 comment
Closed

Comments

@nf-s
Copy link
Contributor

nf-s commented Sep 9, 2020

We can't createStratumInstance with traits which have nested objectTraits (or arrays...)

From slack:
... in WMS catalog item we have LegendTraits and WebMapServiceAvailableLayerStylesTraits which also includes LegendTraits

We copy LegendTraits from availableStyles in @computed get legends()... - https://github.com/TerriaJS/terriajs/blob/next/lib/Models/WebMapServiceCatalogItem.ts#L163-L166

if (layerStyle !== undefined && layerStyle.legend !== undefined) {
  result.push(
    <StratumFromTraits<LegendTraits>>(<unknown>layerStyle.legend)
  );
}

Is there a nice way of copying all traits across instead of having to use createStratumInstance for each LegendTraits (and then createStratumInstance for each LegendItemTraits )?

For example

const legend = createStratumInstance(LegendTraits, layerStyle.legend)
legend.url = 'change the url to something...'
result.push(legend)
@wibily
Copy link
Contributor

wibily commented Jul 7, 2021

Not needed/wrong

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants