Skip to content

fix(databases): render array column items with their element type - #3151

Merged
HarshMN2345 merged 2 commits into
mainfrom
fix-array-column-item-type
Aug 7, 2026
Merged

fix(databases): render array column items with their element type#3151
HarshMN2345 merged 2 commits into
mainfrom
fix-array-column-item-type

Conversation

@HarshMN2345

@HarshMN2345 HarshMN2345 commented Aug 7, 2026

Copy link
Copy Markdown
Member

What does this PR do?

Fixes array columns being rendered as string inputs in the row create/edit form, regardless of the column's actual element type.

Reported against 1.9.6: a Boolean[] column renders a text field ("Enter string") for each item instead of a boolean select.

Before
Empty state shows the correct Boolean[] hint... ...but + Add item produces a string input

Root cause

column.svelte decided the input component like this:

this={column.array || (isSpatialType(column) && limited)
    ? columnsTypeMap['string']
    : columnsTypeMap[column.type]}

The string fallback exists for the spreadsheet inline cell editor, where an entire array is edited as one comma-separated textarea. But it keyed off column.array (the column definition) instead of the array prop (the render mode).

In the full row form, columnItem.svelte renders one <Column> per array element and deliberately does not pass array, so each item should get its element-type input. Because column.array was still true, every item collapsed to the string input.

This also explains the intermittent save failures in the report. The string component still runs parseValue() against column.type, so typing literally true/false/1/0 coerced correctly and saved — anything else returned null, and a null inside a typed array is rejected by the API.

The fix

One line — key off the array prop:

this={array || (isSpatialType(column) && limited)
    ? columnsTypeMap['string']
    : columnsTypeMap[column.type]}

Array items now render their proper inputs: boolean select (True/False/NULL), number input with min/max, date picker, etc.

Scope

  • array is only ever passed by the two fromSpreadsheet branches in columnItem.svelte, so the compact comma-separated cell editor and its "Advanced edit" link are unchanged.
  • Column is used nowhere outside columnItem.svelte.
  • Enum/URL/IP/email arrays were already unaffected — the format branch short-circuits above this.
  • No database-type branching in this path, so it applies to tablesdb and documentsdb alike.

Test Plan

  • Create a table with Boolean[], Integer[], and Datetime[] columns.
  • Create a row: each + Add item now yields the correct typed input; saving succeeds.
  • Edit an existing row: existing values populate correctly.
  • Spreadsheet view: inline cell editing of an array column still shows the comma-separated textarea with "Advanced edit".

Verified locally: bun run check (0 errors), bun run lint (0 errors), bun run test:unit (239 passed), bun run build (compiles clean; the Sentry source-map upload step needs a token and is skipped locally).

Related PRs and Issues

Reported in Discord (1.9.6 console, MongoDB-backed database).

Have you read the Contributing Guidelines on issues?

Yes.

The string fallback in the row column renderer exists for the spreadsheet
inline cell editor, where an entire array is edited as one comma-separated
textarea. It keyed off `column.array` (the column definition) rather than
the `array` prop (the render mode).

In the full row create/edit form, columnItem renders one Column per array
element and deliberately omits the `array` prop so each item gets its
element-type input. Since `column.array` was still true, every item
collapsed to a string input -- a Boolean[] column showed "Enter string".

This also caused intermittent save failures: the string component still ran
parseValue() against column.type, so literal true/false/1/0 coerced and
saved, while anything else yielded null, and a null inside a typed array is
rejected by the API.

Keying off the `array` prop restores per-item typed inputs (boolean select,
number input with min/max, date picker) while leaving the spreadsheet cell
editor and its "Advanced edit" link untouched, since only the two
fromSpreadsheet branches pass `array`.
@appwrite

appwrite Bot commented Aug 7, 2026

Copy link
Copy Markdown

Console (appwrite/console)

Project ID: 688b7bf400350cbd60e9

Sites (1)
Site Status Logs Preview QR
 console-stage
688b7cf6003b1842c9dc
Ready Ready View Logs Preview URL QR Code

Tip

GraphQL API works alongside REST and WebSocket protocols

@greptile-apps

greptile-apps Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR corrects array-item component selection in database row forms while retaining the string-based spreadsheet editor, and separately updates the js-yaml override.

  • Selects typed controls for individual boolean, numeric, datetime, and other array elements.
  • Continues selecting the comma-separated string editor when the explicit spreadsheet array mode is enabled.
  • Updates js-yaml from 4.3.0 to 4.3.1 in the manifest and lockfile.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/rows/columns/column.svelte Uses the render-mode prop rather than column metadata to distinguish whole-array spreadsheet editing from typed per-element row-form editing.
package.json Raises the js-yaml override from 4.3.0 to 4.3.1.
bun.lock Synchronizes the resolved js-yaml package and integrity metadata with the manifest override.

Reviews (2): Last reviewed commit: "chore(deps): raise the js-yaml floor to ..." | Re-trigger Greptile

GHSA-5p4m-2wfm-xmqj (CVE-2026-59870) covers >=4.0.0 <4.3.1 and the fix was
not backported, so the existing >=4.3.0 override stopped clearing it and the
audit step in tests.yml now fails on every branch. It reaches us transitively
via eslint > @eslint/eslintrc > js-yaml.

Only the pinned floor and the resolved version move; integrity hashes are
untouched.
@HarshMN2345
HarshMN2345 merged commit df7f976 into main Aug 7, 2026
4 checks passed
@HarshMN2345
HarshMN2345 deleted the fix-array-column-item-type branch August 7, 2026 06:32
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