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

refactor: convert toolbox items to ES6 classes #5947

Merged
merged 7 commits into from
Feb 22, 2022

Conversation

BeksOmega
Copy link
Collaborator

@BeksOmega BeksOmega commented Feb 16, 2022

The basics

  • I branched from develop
  • My pull request is against develop
  • My code follows the style guide

The details

Resolves

Work on #5860

Proposed Changes

Converts toolbox item, category, and collapsible category to ES6 classes. This involves adding a SENTINEL value very similar to the value used in fields so that we can make sure the toolbox category contents aren't parsed until all of the properties of the category instance have been defined. This involves moving the parsing of category contents into the init method to ensure that all properties of the category instance have been defined before we try to modify them.

Should be no change in behavior fingers crossed.

Reason for Changes

Moving to ES6 classes.

Test Coverage

All unit tests pass.

Documentation

N/A

Additional Information

N/A

@BeksOmega
Copy link
Collaborator Author

@maribethb Just wanted to give you a heads up, I requested your review because you're the most recent person to use this API, and I wanted to make sure I didn't mess things up for external peeps subclassing the categories.

@BeksOmega BeksOmega removed the request for review from cpcallen February 16, 2022 18:31
Copy link
Contributor

@maribethb maribethb left a comment

Choose a reason for hiding this comment

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

Your PR title should say refactor instead of refact. I feel like the conventional commit linter should have caught this... I don't know why it didn't since refact is not in the approved list https://www.npmjs.com/package/@commitlint/config-conventional but ¯\_(ツ)_/¯

core/toolbox/category.js Outdated Show resolved Hide resolved
core/toolbox/category.js Outdated Show resolved Hide resolved
@@ -253,7 +253,6 @@
"./core/extensions.js",
"./core/block.js",
"./core/utils/string.js",
"./core/utils/object.js",
Copy link
Contributor

Choose a reason for hiding this comment

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

what's up with this change? is this the last file that is using object.inherits?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

No clue, something removed it automatically. But if you expand this code block down, it looks like it still exists link. So I don't think I need to add it back in?

@BeksOmega
Copy link
Collaborator Author

Should be ready for another look!

Copy link
Contributor

@maribethb maribethb left a comment

Choose a reason for hiding this comment

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

Looks good although there were a few comments from round 1 that weren't addressed yet (make sure you update the PR title so that this gets categorized correctly in the release notes please!)

Also would you mind updating the PR description to reflect the latest changes? If we come back to look at this PR it could be confusing since we decided not to use the sentinel value.

Thanks!

core/toolbox/collapsible_category.js Outdated Show resolved Hide resolved
core/toolbox/category.js Outdated Show resolved Hide resolved
@BeksOmega BeksOmega changed the title refact: convert toolbox items to ES6 classes refactor: convert toolbox items to ES6 classes Feb 20, 2022
@BeksOmega
Copy link
Collaborator Author

Ok @maribethb :D PR title and description are updated, @extends annotations are removed, inline docs are updated. I think that's everything 🤞

@rachel-fenichel
Copy link
Collaborator

Your PR title should say refactor instead of refact. I feel like the conventional commit linter should have caught this... I don't know why it didn't since refact is not in the approved list https://www.npmjs.com/package/@commitlint/config-conventional but ¯_(ツ)_/¯

The conventional commit linter only checks the shape of the commit message, unfortunately--it doesn't check against an approved list of types.

@BeksOmega BeksOmega merged commit be9ca98 into google:develop Feb 22, 2022
@BeksOmega BeksOmega deleted the refact/toolbox-to-es6 branch February 22, 2022 23:21
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.

5 participants