Skip to content
This repository has been archived by the owner on Jun 29, 2023. It is now read-only.

shift deselect for lists 551 #581

Merged
merged 7 commits into from
Dec 5, 2019

Conversation

pr3tori4n
Copy link
Contributor

Related Issue: #551

Summary

  • Added logic to provide mutli select behavior when deselecting.
  • Note: When revisiting this file I noticed a bunch of boilerplate there just to please typescript. I simplified this because it didn't seem to be providing much value besides satisfying the compiler. It also simplifies the logic I needed to add to selectSiblings
  • re-used selectSiblings for deselect and added a flag for adding/removing since most of hte logic is shared for both cases. Didn't rename, but let me know if you have a new suggested function name.

@pr3tori4n pr3tori4n added the bug Something isn't working label Nov 21, 2019
@pr3tori4n pr3tori4n requested a review from a team as a code owner November 21, 2019 22:50
@pr3tori4n pr3tori4n self-assigned this Nov 21, 2019
Copy link
Member

@driskull driskull left a comment

Choose a reason for hiding this comment

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

Mostly comment removal needed 👍

@pr3tori4n
Copy link
Contributor Author

@driskull @jcfranco removed commented code. Lmk if I can move forward with the as any or if there's a better way unbeknownst to me.

@pr3tori4n pr3tori4n requested a review from driskull November 25, 2019 18:19
Copy link
Member

@driskull driskull left a comment

Choose a reason for hiding this comment

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

The only bummer is the any type. That part of the code being untyped could be bug prone

const domList: HTMLCalcitePickListElement | HTMLCalciteValueListElement = document.querySelector(
`calcite-${type}-list`
);
return domList.getSelectedItems().then((result) => {
Copy link
Member

Choose a reason for hiding this comment

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

Nitpick: can you use await to reduce promise nesting?

@pr3tori4n pr3tori4n requested a review from jcfranco November 26, 2019 22:50
Copy link
Member

@jcfranco jcfranco left a comment

Choose a reason for hiding this comment

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

I really like the idea of marking truly optional props (prop: <type> | undefined) across all components. Ionic components do this already (example). Should the following props also be updated?

pick-list-item | value-list-item

  • textLabel required?
  • icon optional?

It is worth noting that the union type fix is a side-effect and should not be used as a solution for union type errors going forward.

@pr3tori4n pr3tori4n merged commit be6f594 into master Dec 5, 2019
@pr3tori4n pr3tori4n deleted the hrobbins/pick-list-shift-unselect-551 branch December 5, 2019 00:03
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants