Skip to content

Conversation

@algusarov
Copy link

@algusarov algusarov commented Dec 25, 2025

Summary

  • Replace comma-based join/split with JSON serialization for array fields
  • Prevents corruption of array items containing commas (JSON, CSV, plain text)
  • Update placeholder text to reflect JSON array format

Root Cause

The spreadsheet editor used comma-based serialization (value.map(String).join(', ') and stringValue.split(',')) which corrupted any array items containing commas. Simply opening a cell for editing would corrupt in-memory data through two-way binding.

See detailed analysis in #2740.

⚠️ Warning

This is an experimental fix that changes console UX for array-based types.

Users will now need to enter array values in JSON format (e.g., ["item1", "item2"]) instead of comma-separated values. This needs careful review to ensure it doesn't negatively impact the user experience for simpler use cases.

Closes #2740

Summary by CodeRabbit

  • Improvements
    • Array input fields now use JSON array format for better data handling and display
    • Updated placeholder guidance for integer, double, boolean, and string array inputs with clear examples of proper JSON formatting syntax
    • Enhanced user experience with clearer input format expectations for array-type fields

✏️ Tip: You can customize this high-level summary in your review settings.

Replace comma-based join/split with JSON.stringify/parse to prevent
corruption of array items containing commas (JSON, CSV, plain text).

Closes appwrite#2740
@appwrite
Copy link

appwrite bot commented Dec 25, 2025

Console (appwrite/console)

Project ID: 688b7bf400350cbd60e9

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

Tip

Functions can run for up to 15 minutes before timing out

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 25, 2025

Walkthrough

This pull request modifies the string input component for database table rows to handle array values using JSON format instead of comma-separated strings. Array values are now serialized with JSON.stringify(value, null, 2) and deserialized by attempting to parse the input as JSON. Placeholder texts for array-type inputs (integer, double, boolean, string) have been updated to reflect the new JSON array format requirement. Spatial-type and non-array value handling remain unchanged.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~13 minutes

Pre-merge checks and finishing touches

✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: switching from comma-based to JSON serialization for array fields.
Linked Issues check ✅ Passed The pull request fully addresses issue #2740 by replacing comma-based array handling with JSON.stringify/parse, eliminating corruption of JSON string items.
Out of Scope Changes check ✅ Passed All changes are directly related to fixing the array serialization issue in the spreadsheet editor; no unrelated modifications detected.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e446f7f and 1e37b3f.

📒 Files selected for processing (1)
  • src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/rows/columns/types/string.svelte
🧰 Additional context used
📓 Path-based instructions (5)
**/*.{ts,tsx,js,jsx,svelte}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{ts,tsx,js,jsx,svelte}: Import reusable modules from the src/lib directory using the $lib alias
Use minimal comments in code; reserve comments for TODOs or complex logic explanations
Use $lib, $routes, and $themes aliases instead of relative paths for module imports

Files:

  • src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/rows/columns/types/string.svelte
src/routes/**/*.svelte

📄 CodeRabbit inference engine (AGENTS.md)

Use SvelteKit file conventions: +page.svelte for components, +page.ts for data loaders, +layout.svelte for wrappers, +error.svelte for error handling, and dynamic route params in square brackets like [param]

Files:

  • src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/rows/columns/types/string.svelte
**/*.{ts,tsx,js,jsx,svelte,json}

📄 CodeRabbit inference engine (AGENTS.md)

Use 4 spaces for indentation, single quotes, 100 character line width, and no trailing commas per Prettier configuration

Files:

  • src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/rows/columns/types/string.svelte
**/*.svelte

📄 CodeRabbit inference engine (AGENTS.md)

Use Svelte 5 + SvelteKit 2 syntax with TypeScript for component development

Files:

  • src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/rows/columns/types/string.svelte
src/routes/**

📄 CodeRabbit inference engine (AGENTS.md)

Configure dynamic routes using SvelteKit convention with [param] syntax in route directory names

Files:

  • src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/rows/columns/types/string.svelte
🧠 Learnings (3)
📚 Learning: 2025-09-30T07:41:06.679Z
Learnt from: ItzNotABug
Repo: appwrite/console PR: 2425
File: src/routes/(console)/project-[region]-[project]/databases/database-[database]/(suggestions)/empty.svelte:454-468
Timestamp: 2025-09-30T07:41:06.679Z
Learning: In `src/routes/(console)/project-[region]-[project]/databases/database-[database]/(suggestions)/empty.svelte`, the column suggestions API (console.suggestColumns) has a maximum limit of 7 columns returned, which aligns with the initial placeholder count of 7 in customColumns.

Applied to files:

  • src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/rows/columns/types/string.svelte
📚 Learning: 2025-10-04T11:46:32.504Z
Learnt from: ItzNotABug
Repo: appwrite/console PR: 2442
File: src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/columns/float.svelte:88-88
Timestamp: 2025-10-04T11:46:32.504Z
Learning: In the Appwrite Console codebase, for float/double column inputs in database table column configuration files (like float.svelte), use step={0.1} for InputNumber components, not step="any". This is the established pattern for float/double precision inputs.

Applied to files:

  • src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/rows/columns/types/string.svelte
📚 Learning: 2025-10-07T14:17:11.597Z
Learnt from: ItzNotABug
Repo: appwrite/console PR: 2413
File: src/routes/(console)/project-[region]-[project]/databases/database-[database]/(entity)/helpers/terminology.ts:28-28
Timestamp: 2025-10-07T14:17:11.597Z
Learning: In src/routes/(console)/project-[region]-[project]/databases/database-[database]/(entity)/helpers/terminology.ts, the empty `vectordb: {}` entry in baseTerminology is intentional. The vectordb database type is not currently used because the backend API is not finalized, and no database type returns 'vectordb' at the moment.

Applied to files:

  • src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/rows/columns/types/string.svelte
🔇 Additional comments (3)
src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/rows/columns/types/string.svelte (3)

76-86: LGTM! JSON serialization prevents comma corruption.

The switch from join(', ') to JSON.stringify(value, null, 2) correctly resolves the corruption issue for array items containing commas. Pretty printing with indentation enhances readability.


88-106: Solid array parsing implementation with proper safeguards.

The JSON.parse approach with try-catch and the comparison guard on line 92 correctly handles the two-way binding pattern. The Array.isArray check appropriately rejects non-array JSON inputs.

Note: Invalid JSON is silently ignored (line 96), providing no user feedback. This appears intentional given the component structure, though a visual error indicator could improve UX if added later.


108-134: Clear placeholder guidance for JSON array format.

The updated placeholders effectively communicate the new input format with type-specific examples, helping users adapt to the JSON-based entry requirement.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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.

Advanced edit doesn't show JSON strings correctly in TablesDB UI (upd - any strings with commas)

1 participant