This repository was archived by the owner on Jun 5, 2025. It is now read-only.
Add data migration for widgets from string to JSON format#331
Merged
EricJohnson327 merged 6 commits intomainfrom Jan 25, 2024
Merged
Add data migration for widgets from string to JSON format#331EricJohnson327 merged 6 commits intomainfrom
EricJohnson327 merged 6 commits intomainfrom
Conversation
vineeththomasalex
approved these changes
Jan 24, 2024
guimafelipe
approved these changes
Jan 24, 2024
krschau
approved these changes
Jan 24, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Summary of the pull request
The multi-account support changes also changed the widget state from a string to a JSON string so we could encode more flexible data. However, existing widget data is still the string format, so to prevent users from losing their widget configuration we needed to add migration code to convert the string format to the JSON string format. This PR adds that for the two categories of widgets, the Repository widget and the User widget.
References and relevant issues
https://task.ms/48658002
Detailed description of the pull request / Additional comments
This fix is not a robust migration support feature with data versioning and migrating from version N to version M, which we should absolutely add before making any further data format changes. This change is a rather crude existence check for the old format and changing it to the new format by seeing if it fails JSON parsing and if so, assume it is the old format and convert to the new format. This is a quick fix to unblock the release.
Changes:
Strongly recommend a future task to add data versioning to the widget data as one of the JSON node values and adding a widget check on creation that compares the current data version to the one the widget expects and to handle any migration if necessary.
Validation steps performed
PR checklist