Reference token metadata internally fix custom tokens label bug #21767
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.
Overview
Reference token metadata internally. This also fixes a metadata issue @magnolia61 identified where the metadata for custom fields was 'falling through' to the metadata for 'all fields' - resulting in 🏷️ variants being incorrectly added
Before
Data is stored in token metadata - it may ALSO be stored as field metadata. When we access via field metadata if will use getFields to fetch if not present
After
Referring to the token metadata array allows us to avoid an extra getfields & is a step towards only using that look up to build the token metadata
Technical Details
This references the token metadata rather than the metadata retrieved from the api
call. Since the former is cached it should save a look up -
albeit not when prefetch is happening, at this stage
Comments
@colemanw you only just merged it & I changed it :-) If this passes would be good to get it merged as #21761 builds on it