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

fix: comment have XML save and load new workspace comments classes #7931

Merged
merged 5 commits into from
Mar 20, 2024

Conversation

BeksOmega
Copy link
Collaborator

@BeksOmega BeksOmega commented Mar 12, 2024

The basics

The details

Resolves

Fixes N/A

Proposed Changes + reasons

Updates the XML system to save and load new workspace comment classes for a ✨ seamless transition ✨

Test Coverage

Added round-trip tests for comments. This also covers the logic for all the headless setters and getters (as promised in a previous PR)

Documentation

N/A

Additional Information

Sorry about the derpy format for the serialization tests. But rewriting them to be mocha style isn't worth it.

When writing this I realized that JSON isn't handling RTL correctly. I used the same (bad) implementation here, then I'm going to fix it in my next PR.

@github-actions github-actions bot added PR: fix Fixes a bug and removed PR: fix Fixes a bug labels Mar 12, 2024
@BeksOmega BeksOmega force-pushed the fix/comment-xml branch 5 times, most recently from f7ee13b to 07a22ec Compare March 18, 2024 17:38
@BeksOmega BeksOmega marked this pull request as ready for review March 20, 2024 19:52
@BeksOmega BeksOmega requested a review from a team as a code owner March 20, 2024 19:52
@BeksOmega BeksOmega requested a review from maribethb March 20, 2024 19:52
core/xml.ts Outdated Show resolved Hide resolved
core/xml.ts Show resolved Hide resolved
tests/mocha/serializer_test.js Outdated Show resolved Hide resolved
@@ -478,6 +491,34 @@ export function domToWorkspace(xml: Element, workspace: Workspace): string[] {
return newBlockIds;
}

/** Deserializes the given comment state into the given workspace. */
function loadWorkspaceComment(
Copy link
Contributor

Choose a reason for hiding this comment

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

I am curious why not have this implemented as a function on the class itself, like it used to be? It seems like that would make it easier on people who are implementing custom subclasses, and it would make more sense organizationally IMO. And we do have a pattern of a fromXml method on fields, events, etc.

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 one is allowed to implement custom subclasses atm. We discussed that and decided YAGNI.

Copy link
Contributor

Choose a reason for hiding this comment

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

Fair enough :)

@BeksOmega BeksOmega merged commit 5462b21 into google:rc/v11.0.0 Mar 20, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: fix Fixes a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants