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

chore(TreeView): converted examples to TypeScript #8448

Closed
wants to merge 6 commits into from

Conversation

kev-kim
Copy link
Contributor

@kev-kim kev-kim commented Dec 15, 2022

What:

Additional issues:

@patternfly-build
Copy link
Contributor

patternfly-build commented Dec 15, 2022

Copy link
Contributor

@wise-king-sullyman wise-king-sullyman left a comment

Choose a reason for hiding this comment

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

Good work on this so far! A few mostly small things:

Comment on lines +8 to +11
// Ignore folders for selection
if (treeViewItem && !treeViewItem.children) {
setActiveItems([treeViewItem]);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this change addressing another issue?

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 what you're asking

Copy link
Contributor

Choose a reason for hiding this comment

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

I wasn't sure where this change came from/how it relates to the example conversion.

If it wasn't for/from some other issue can you explain why it was required?

Comment on lines -483 to -500
console.log(checked);

const checkedItemTree = this.options
.map(opt => Object.assign({}, opt))
.filter(item => this.filterItems(item, treeViewItem));
const flatCheckedItems = this.flattenTree(checkedItemTree);
console.log('flat', flatCheckedItems);

this.setState(
prevState => ({
checkedItems: checked
? prevState.checkedItems.concat(
flatCheckedItems.filter(item => !prevState.checkedItems.some(i => i.id === item.id))
)
: prevState.checkedItems.filter(item => !flatCheckedItems.some(i => i.id === item.id))
}),
() => {
console.log('Checked items: ', this.state.checkedItems);
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm curious why you removed these console logs.

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 doesn't let me commit with console logs

Copy link
Contributor

Choose a reason for hiding this comment

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

Even if you add an eslint-disable-next-line no-console linter disabling comment before it?

const checkedItemTree = options.map(opt => Object.assign({}, opt)).filter(item => filterItems(item, treeViewItem));
const flatCheckedItems = flattenTree(checkedItemTree);

setCheckedItems(
Copy link
Contributor

Choose a reason for hiding this comment

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

I think you should use an updater function for the current state of checkedItems here as well.

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 entirely sure how to do that since it relies on the "checked" boolean

Copy link
Contributor

Choose a reason for hiding this comment

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

🤔 are you not able to access that variable from within an updater function?

@wise-king-sullyman
Copy link
Contributor

Changes so far look good, left a few replies.

@stale
Copy link

stale bot commented Apr 9, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@stale stale bot added the wontfix label Apr 9, 2023
@wise-king-sullyman
Copy link
Contributor

@kev-kim are you interested in trying to finish up this PR?

One note, you would need to rebase this PR and target the v5 branch rather than main.

@stale stale bot removed the wontfix label Apr 11, 2023
@thatblindgeye thatblindgeye self-assigned this Jun 16, 2023
@thatblindgeye thatblindgeye removed their assignment Jun 20, 2023
@thatblindgeye
Copy link
Contributor

Closing in favor of #9286

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.

Tree view: convert examples to TS
4 participants