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

Interactive legend: Re-calculate layer data when layer is off by default. #154

Merged
merged 3 commits into from
Jun 23, 2023

Conversation

rslibed
Copy link
Collaborator

@rslibed rslibed commented Jun 23, 2023

No description provided.

@kellyhutchins
Copy link
Member

@rslibed this one is for a patch right? If so then @bcree11 hold off on the scalebar update until patching is over

export function getIntLegendLayerData(fLayer: __esri.FeatureLayer, data): IIntLegendLayerData {
return data?.[fLayer?.id];
export function getIntLegendLayerData(fLayer: __esri.FeatureLayer): IIntLegendLayerData {
const data = interactiveLegendState?.data?.[fLayer?.id];
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be returned instead of creating a new variable and not doing anything with it. Also, the return type for this would have better checking if it was IIntLegendLayerData | undefined since that's what's actually being returned due to the optional chaining.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Keeping the return type the same for now, changing it will affect other functions. Will address in the future when we're done patching.

export function updateStore(data: IInteractiveLegendData, layerData?: { intLegendLayerData: IIntLegendLayerData; layerId: string }): void {
const layerId = layerData?.layerId;
export function updateStore(layerData: { intLegendLayerData: IIntLegendLayerData; layerId: string }): void {
const layerId = layerData?.layerId as string;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could wrap all the lines in this function in an if statement if(layerData != null), then you wouldn't need the optional chaining. If layerId is undefined or null you wouldn't want to run store.set(…)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point! Done

@bcree11
Copy link
Collaborator

bcree11 commented Jun 23, 2023

@rslibed this one is for a patch right? If so then @bcree11 hold off on the scalebar update until patching is over

Yep, I don't plan on merging the scale bar until later

@rslibed rslibed merged commit 947af3f into master Jun 23, 2023
@rslibed rslibed deleted the rslibed/iac-interactive-legend branch June 23, 2023 20:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants