Skip to content

fix: resolve MantineStyleProp function/array values for table style - #840

Open
Rawi2115 wants to merge 1 commit into
icflorescu:nextfrom
Rawi2115:fix/styles-prop-function-array
Open

fix: resolve MantineStyleProp function/array values for table style#840
Rawi2115 wants to merge 1 commit into
icflorescu:nextfrom
Rawi2115:fix/styles-prop-function-array

Conversation

@Rawi2115

Copy link
Copy Markdown

The table's style prop was built via object-spread of styles?.table, which silently drops function values (functions have no enumerable own properties) and mishandles arrays (spreading an array into an object produces numeric keys, not valid CSS), causing a runtime TypeError when an array was passed.

Pass style as an array instead, matching the pattern already used for the root Box, so Mantine's built-in style resolver correctly handles CSSProperties, functions, and arrays per MantineStyleProp.
Verified with the repro cases from the issue:

  • table: () => ({ color: 'red' }) — now renders red (was previously ignored)
  • table: [{ color: 'red' }] — now renders red with no runtime error (previously threw TypeError: Failed to set an indexed property [0] on 'CSSStyleDeclaration')
  • table: { color: 'red' } — still works as before (no regression)

Fixes #835

The table's style prop was built via object-spread of styles?.table,
which silently drops function values (functions have no enumerable
own properties) and mishandles arrays (spreading an array into an
object produces numeric keys, not valid CSS), causing a runtime
TypeError when an array was passed.

Pass style as an array instead, matching the pattern already used
for the root Box, so Mantine's built-in style resolver correctly
handles CSSProperties, functions, and arrays per MantineStyleProp.

Fixes icflorescu#835
@codesandbox

codesandbox Bot commented Aug 26, 2026

Copy link
Copy Markdown

Review or Edit in CodeSandbox

Open the branch in Web EditorVS CodeInsiders

Open Preview

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.

1 participant