Resolve badge and alert state icons through static tags - #2
Merged
Conversation
Badge and alert both branch on tone to pick one of four built-in icons, and did so through <x-shape::icon :name="$glyph" />, which falls through Laravel's <x-dynamic-component> for any name not known at compile time. That path writes a temp file on first use of a given icon name and reads it back, and on windows-latest CI that first read has come back empty — deterministically for whichever test file happens to touch a given icon name first, which is why BadgeTest's icon assertions failed in full on the P8.5/L13/prefer-lowest Windows lane while AlertTest, exercising the very same icon names moments later, passed. The four built-in states are always the same fixed set of components, so they can be reached with a literal tag per tone instead, which folds and memoizes like any other anonymous component and never goes near the dynamic-component temp file. A caller's own :icon name still needs the dynamic path, since there's no fixed set of those to special-case against.
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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
toneto pick one of four built-in icons, and did so through<x-shape::icon :name="$glyph" />, which drops into Laravel's<x-dynamic-component>for any name not known at compile time.windows-latestthat first read has come back empty, deterministically for whichever test file happens to touch a given icon name first. That's whyBadgeTest's icon assertions failed in full onP8.5 - L13.* - prefer-lowest - windows-latest, whileAlertTest— exercising the very same icon names moments later in the same run — passed.<x-shape::icon.shape-{tone} />tag instead. That folds and memoizes like any other anonymous component and never touches the dynamic-component temp file. A caller's own:iconname still goes through the dynamic path, since there's no fixed set of those to special-case against.Test plan
composer testlocally (passing on macOS/prefer-stable already)P8.5 - L13.* - prefer-lowest - windows-latestlane, which reproduced this failure onmain, passes here