Skip to content

Conversation

@FezVrasta
Copy link
Contributor

fixes #24

const { prop, compositeID, displayPosition } = v.getProperties();

// Return false to mark this item for removal
if (prop == null) return false;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should we write if (!prop) { return false; } instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm used to == null because it's the quickest way to check for null and undefined while not checking for any other falsy value, I know in this case it will always be either an object-type or null/undefined so it's not strictly needed, i't just clearer to me. (I come from a strict Flow-type checking background, sorry 😬)

this.selections.forEach((v) => {
const { prop } = v.getProperties();
const { representationId } = prop.get('representationId');
const representationId = prop?.get('representationId').representationId;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure if your build pipeline supports the optional chaining operator, I can replace it with something else if not.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Not sure either.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is, I just checked the dist output.

@jourdain
Copy link
Collaborator

jourdain commented Aug 2, 2021

Thanks, does that solve your issue?

Can you rename your commit like fix(View): Prevent invalid access when picking

@FezVrasta
Copy link
Contributor Author

Thanks, does that solve your issue?

Yes it works indeed

@jourdain jourdain merged commit b41817b into Kitware:master Aug 2, 2021
@jourdain
Copy link
Collaborator

jourdain commented Aug 2, 2021

Thanks for your contribution!

@FezVrasta FezVrasta deleted the fix/24 branch August 2, 2021 16:44
@jourdain
Copy link
Collaborator

jourdain commented Aug 2, 2021

🎉 This PR is included in version 1.5.10 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Can't pick DataArray + SliceRepresentation

2 participants