Uh oh!
There was an error while loading. Please reload this page.
Widen TableDefault class attr to :any so class={[...]} idiom works - #566
Closed
mdon wants to merge 1 commit into
Closed
Widen TableDefault class attr to :any so class={[...]} idiom works#566mdon wants to merge 1 commit into
mdon wants to merge 1 commit into
Conversation
`attr :class, :string` rejects a list at compile time, but every
TableDefault component already accepts lists internally — they
wrap `@class` inside another list that Phoenix flattens. The
:string declaration is just a stale guard from before the
internal usage settled.
Surfaces as a warning when a consumer uses the Phoenix-standard
`class={[if(...), if(...)]}` idiom for conditional classes:
warning: attribute "class" in component
PhoenixKitWeb.Components.Core.TableDefault.table_default_row/1
must be a :string, got: [if !endpoint.enabled do
"opacity-60" end, ...]
endpoints.html.heex:241
Triggered by `phoenix_kit_ai`'s endpoint list table (the only
current external consumer using a conditional class list). Same
fix applied uniformly to all seven `attr :class` declarations in
the file (`table_default/1`, `table_default_header/1`,
`table_default_row/1`, `table_default_body/1`,
`table_default_cell/1`, `table_default_header_cell/1`,
`table_default_search/1`) so future consumers don't relitigate
the same warning per-component.
Defaults are kept as strings (`""` and `"bg-base-300"`) — only
the type widens.mdon
commented
May 22, 2026
ContributorAuthor
Folding into #565 — bundling phoenix_kit follow-ups into one PR per module per session. The same one-line commit will be cherry-picked there. |
5 tasks
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 freeto 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
The seven
attr :class, :stringdeclarations on thePhoenixKitWeb.Components.Core.TableDefault.*family rejectPhoenix-idiomatic
class={[...]}at compile time, but everycomponent already accepts lists internally — they wrap
@classinside another list that Phoenix flattens. The
:stringdeclarationis a stale guard from before the internal usage settled.
Surfaced when
phoenix_kit_ai's endpoint list table uses aconditional-class list:
Fix applied uniformly to all seven components in the file
(
table_default/1,table_default_header/1,table_default_row/1,table_default_body/1,table_default_cell/1,table_default_header_cell/1,table_default_search/1) so futureconsumers don't relitigate the same warning per-component. Defaults
unchanged (still string literals).
Notes
class={[...]}andclass={["a", false, "b"]}nowcompile cleanly, with Phoenix's standard nil/false filtering and
flattening applied at render time.
Test plan
mix compile --warnings-as-errorscleanmix format --check-formattedcleanmix credo --strictclean on touched file