Add code block library version number #1437
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently, whenever a project is loaded, the server evaluates the project code to identify and possibly replace deprecated block constructs. It does this regardless of how many times previously this was done.
This patch does the following to address the unnecessary parsing on subsequent project load operations.
First, it establishes a block code library version number that identifies a known state for the blocks at any given time. This number is incremented whenever there are breaking changes introduced into the block library.
Second, it adds code to compare the project code block library version with the existing library version. If they do not match, the server will send the project code through the deprecated block filter before passing the code to the client browser. This will effectively prevent code that has already been filtered from going through the process again until the next breaking change in the block library.
Finally, the server updates the code library version in the project record when the project is saved from a previous code library version. There is an assumption made that the code returned to the server is already filtered and compatible with the current code block library version.