Skip to content

Properly resolve theme('someKey.DEFAULT') when only --some-key-* keys exist - #14354

Merged
adamwathan merged 2 commits into
nextfrom
fix/default-theme-values-resolving-to-objects
Sep 6, 2024
Merged

Properly resolve theme('someKey.DEFAULT') when only --some-key-* keys exist#14354
adamwathan merged 2 commits into
nextfrom
fix/default-theme-values-resolving-to-objects

Conversation

@adamwathan

Copy link
Copy Markdown
Member

This PR fixes an issue where theme function calls like theme('transitionTimingFunction.DEFAULT') would incorrectly resolve to an object when the set of defined CSS theme values looked like this:

@theme {
  --transition-timing-function-in: ease-in;
  --transition-timing-function-out: ease-out;
  --transition-timing-function-in-out: ease-out;
}

We were mistakenly retrieving the entire --transition-timing-function-* namespace in this case and returning an object, even though the user is explicitly asking for a single value by including .DEFAULT in their call.

This ensures it resolves to null instead. Fixes an issue I ran into on this live stream earlier today:

https://x.com/adamwathan/status/1831740214051799281

@RobinMalfait
RobinMalfait force-pushed the fix/default-theme-values-resolving-to-objects branch from f4e6bef to 9174b09 Compare September 5, 2024 22:11
@adamwathan
adamwathan force-pushed the fix/default-theme-values-resolving-to-objects branch from 9174b09 to 91e9d29 Compare September 6, 2024 03:55
@RobinMalfait
RobinMalfait force-pushed the fix/default-theme-values-resolving-to-objects branch from 91e9d29 to 9a8d3c2 Compare September 6, 2024 11:00
@adamwathan
adamwathan merged commit 7b59aac into next Sep 6, 2024
@adamwathan
adamwathan deleted the fix/default-theme-values-resolving-to-objects branch September 6, 2024 13:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants