Dynamic enum values lost when editing code
Open
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 2.3k
- Forks
- 641
- Avg merge
- 12h 4m
- Merged PRs (30d)
- 57
Description
Dynamic enum values reset to 0 once a change was made in the code.
To Reproduce
- Go to https://makecode.com/playground#language-create-enums
- Click 'Run'
- Add a 'Show $color' block from the 'Language' menu and give it a non-zero value (Blue or Yellow)
4.Switch to the JavaScript view - Add an empty line at the end of the code
- Switch back to Blocks view
- The block displays the value Red (0), while the code shows otherwise
- When in actual projects, saving and reloading resets the value to 0 also in the code view resulting in real data loss
Expected behavior - Blocks and code values should be in sync
- Values should not be lost after reload
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the issue in the linked MakeCode enum playground, comparing the Blocks and JavaScript views after changing a dynamic enum value and reloading. Trace the code that serializes and restores enum values during the Blocks/JavaScript transition and project reload. Done means non-zero values remain synchronized in both views and survive saving and reloading.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100