Skip to content

Conversation

@pmalacho-mit
Copy link
Collaborator

Resolves

What Github issue does this resolve (please include link)?

Proposed Changes

Describe what this Pull Request does

Reason for Changes

Explain why these changes should be made

Test Coverage

Please show how you have added tests to cover your changes

var isSingleSprite = false;
if (isSingleSpriteOrExtensionManager && isSingleSpriteOrExtensionManager.runtime == runtime) {
extensionManager = isSingleSpriteOrExtensionManager;
} else if (isSingleSpriteOrExtensionManager == true && isSingleSpriteOrExtensionManager == false) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This else if seems contradictory

}
if (Object.prototype.hasOwnProperty.call(object, 'blocks')) {
deserializeBlocks(object.blocks);
deserializeBlocks(object.blocks, extensionManager);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Can remove extensionManager argument

var { inputs, variables } = gatherInputs(object.blocks, blockJSON);
var fields = gatherFields(blockJSON, blockArgs);
var totalList = addInputsAndFields(inputs, fields, blockArgs);
const newInputs = {};
Copy link
Collaborator Author

@pmalacho-mit pmalacho-mit Jun 25, 2024

Choose a reason for hiding this comment

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

FYI Not sure about this variable specifically, but for a lot of this storage objects, it'd lead to easier to read code to use a Map instead.

And if you later need an object, you can always go: const obj = Object.fromEntries(map);

const regex = /_v\d+/g; // Matches _v followed by one or more digits
blockInfoIndex = blockInfoIndex.replace(regex, ""); // Replaces all matches with an empty string
const menuRegex = /menu_\d+/;
if (!menuRegex.test(blockInfoIndex)) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Interesting! so we don't apply version to menus, makes sense -- I do wonder what happens when a project is saved with a menu value that disappears in later versions. Is that something that's handled?

}

}
obj[blockID] = serializeBlock(blocks[blockID], blocks);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

So we store the version in the opcode but the ID is kept the same?

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.

3 participants