Remove unused 'id' field functionality from studio.tokens extension and add cleanup logic for legacy tokens #3565
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
This PR removes all functionality related to the automatically generated 'id' field in the
studio.tokens
extension while adding backward compatibility to clean up existing ID fields when parsing tokens. The id field was being added to tokens but never actually used anywhere in the codebase, making it unnecessary overhead.Changes Made
Removed Utility Functions
addIdPropertyToTokens.ts
- Completely removed this utility that was adding UUIDs to tokensremoveTokenId.ts
- Removed utility for stripping IDs from tokensremoveIdPropertyFromTokens.ts
- Removed batch ID removal utilityAdded Cleanup Logic
cleanupTokenExtensions.ts
- New utility function that removes 'id' fields from studio.tokens extensions during token parsingconvertToTokenArray
- Integrated cleanup logic to automatically remove legacy ID fields when parsing tokensUpdated Core Token Handling
tokenState.tsx
- Removed all calls toaddIdPropertyToTokens()
and UUID importsupdateTokenPayloadToSingleToken.ts
- Simplified to no longer generate or include IDs and refactored for better code qualitystringifyTokens.ts
,formatTokens.ts
,convertTokensToObject.ts
) - Removed ID-related parameters and processingUpdated Components and Storage
storeTokenIdInJsonEditor
parameter usage from components likePushJSON.tsx
andMultiFilesExport.tsx
GitSyncOptimizer.ts
,RemoteTokenStorage.ts
) to use simplified function signaturesTest Updates
Impact
Before:
After:
Benefits
No breaking changes to user-facing functionality since the IDs were never exposed or used in the UI or token operations. Users with existing tokens containing ID fields will have them automatically removed during parsing.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.