Skip to content

Conversation

ItzNotABug
Copy link
Member

@ItzNotABug ItzNotABug commented Sep 2, 2025

What does this PR do?

(Provide a description of what this PR does.)

Test Plan

(Write your test plan here. If you changed any code, please provide us with clear instructions on how you verified your changes work.)

Related PRs and Issues

(If this PR is related to any other PR or resolves any issue or related to any issue link all related PR and issues here.)

Have you read the Contributing Guidelines on issues?

(Write your answer here.)

Summary by CodeRabbit

  • New Features

    • Confirm dialogs support a customizable confirmation label, with dynamic wording for deleting two‑way relationships.
    • Relationship field options now show combined values with a short row ID suffix for clearer identification.
  • Bug Fixes

    • Column filtering logic adjusted to better include/exclude system and ID columns.
    • Spreadsheet saves now send full row data so system columns are preserved.
    • Timestamp column display names updated to “$createdAt” and “$updatedAt”.
  • Style

    • Increased spacing in the row editor; refined menu divider spacing and action-menu alignment.
  • Chores

    • Updated UI dependency and package manager patch version.

Copy link

appwrite bot commented Sep 2, 2025

Console

Project ID: 688b7bf400350cbd60e9

Sites (2)
Site Status Logs Preview QR
 console-qa
688b7cf6003b1842c9dc
Ready Ready View Logs Preview URL QR Code
 console-cloud
688b7c18002b9b871a8f
Ready Ready View Logs Preview URL QR Code

Note

You can use Avatars API to generate QR code for any text or URLs.

@ItzNotABug ItzNotABug self-assigned this Sep 2, 2025
Copy link
Contributor

coderabbitai bot commented Sep 2, 2025

Walkthrough

Updates include dependency bumps in package.json. In the UI: confirm.svelte adds a new public prop to customize the confirmation checkbox label. deleteColumn.svelte now passes a dynamic confirmation label and removes a delete-choice UI. Filterable-columns logic in the table page is refactored to include/exclude $id and system columns based on selection. Column display names for $createdAt and $updatedAt are adjusted. Relationship option labels now join values with an ID suffix. Spreadsheet updates now send the full row without filtering system keys. Sheet options adjust divider spacing and CSS selectors. Editor layout spacing increases. Billing planSummary.svelte removes per-cell expansion controls.

Possibly related PRs

Suggested reviewers

  • lohanidamodar
  • eldadfux
  • Meldiron
✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch misc-fixes

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore or @coderabbit ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (6)
src/lib/components/confirm.svelte (1)

13-13: Configurable checkbox label: good enhancement.

Prop name and binding are clear; keeps API backward compatible.

Minor: consider a more generic name (confirmLabel) to reuse the component beyond deletions without implying the action.

Also applies to: 50-50

src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/columns/+page.svelte (1)

74-74: System datetime labels switched to “$createdAt”/“$updatedAt”: consistent with keys.

Matches the header rendering that prefers column.name for system keys. No issues spotted.

To avoid drift, consider a small map/const for system label overrides instead of inlining strings in multiple places.

Also applies to: 86-86

src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/+page.svelte (1)

64-65: Minor: defensively handle missing isAction.

Until the mapping is fixed, guard to avoid TypeScript grief:

-return [...idColumn, ...columns.filter((column) => !column.isAction), ...systemColumns];
+return [...idColumn, ...columns.filter((c) => !(c as any)?.isAction), ...systemColumns];
src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/rows/columns/types/relationship.svelte (1)

145-146: Label polish: use a true ellipsis and keep IDs compact.

Purely cosmetic:

-                    label = `${values.join(' | ')} (...${row.$id.slice(-5)})`;
+                    label = `${values.join(' | ')} (…${row.$id.slice(-5)})`;
src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/sheetOptions.svelte (2)

166-171: Make “last divider” detection robust to future menu changes.

index === menuItems.length - 2 assumes exactly one item after the final divider. Compute it from the tail instead.

-                        {@const isLastDivider = index === menuItems.length - 2}
+                        {@const isLastDivider = menuItems.slice(index + 1).every((i) => !i.divider)}
                         <div
                             style:margin-inline="-1rem"
                             style:padding-block-start="0.5rem"
                             style:padding-block-end={isLastDivider ? '0.25rem' : '0.5rem'}>

188-194: Avoid relying on CSS nesting; write an explicit selector.

If CSS nesting isn’t guaranteed by your tooling, the nested & rule may not apply.

-    .action-menu-root {
-        margin-inline-start: calc(var(--space-2) * -1);
-
-        & :global(:first-child) {
-            overflow: visible;
-        }
-    }
+    .action-menu-root {
+        margin-inline-start: calc(var(--space-2) * -1);
+    }
+    :global(.action-menu-root > :first-child) {
+        overflow: visible;
+    }
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 579f8a9 and f411af7.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (9)
  • package.json (2 hunks)
  • src/lib/components/confirm.svelte (2 hunks)
  • src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/+page.svelte (1 hunks)
  • src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/columns/+page.svelte (2 hunks)
  • src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/columns/deleteColumn.svelte (2 hunks)
  • src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/rows/columns/types/relationship.svelte (3 hunks)
  • src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/rows/edit.svelte (1 hunks)
  • src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/sheetOptions.svelte (2 hunks)
  • src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/spreadsheet.svelte (1 hunks)
🔇 Additional comments (8)
package.json (1)

29-29: Deps bump looks good; please verify pnpm version and UI impact

  • pink-svelte@a7a9b5d peers on Svelte ^4.0.0 (matches our project) and isn’t duplicated in pnpm-lock.yaml
  • Manually test Spreadsheet, Layout, Tooltip for any UI regressions
  • Confirm local and CI are using pnpm 10.15.1 to prevent lockfile churn
src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/rows/edit.svelte (1)

171-171: UI spacing tweak LGTM.

Increasing gap to xl improves readability in dense forms. No functional impact.

src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/spreadsheet.svelte (1)

574-575: Verify that updateRow strips system keys

  • The implementation of updateRow wasn’t located—confirm it ignores or removes keys in PROHIBITED_ROW_KEYS (e.g. $id, $createdAt, $updatedAt, etc.).
  • If it doesn’t, sanitize the payload client-side by filtering out those keys (e.g. via Object.entries(row).filter against PROHIBITED_ROW_KEYS).
src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/+page.svelte (2)

59-63: Confirm intent: system columns included only when “selected.”

idColumn is included when NOT selected, but systemColumns are included only WHEN selected. If “selected” means hidden columns (as used in hide: selected.includes(...)), this is inverted relative to $id.

If the goal is “filters show visible columns,” flip the predicate:

-        ].filter((col) => !!selected.includes(col.id));
+        ].filter((col) => !selected.includes(col.id));

72-72: LGTM on using the helper for filterColumns.

Nice centralization; once the isAction fix lands, this should behave as intended.

src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/rows/columns/types/relationship.svelte (2)

125-167: Signature simplification of generateOptions is clean.

Dropping the editing param tightens the API; call sites updated accordingly.


181-182: Reactive options call looks correct.

Good: guards undefined rows and threads column through the new signature.

src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/columns/deleteColumn.svelte (1)

92-92: Prop passing bug: use explicit prop syntax

{confirmDeletionLabel} inside the opening tag isn’t a valid Svelte prop and will fail to compile. Pass it as a named prop.

Apply this diff:

-    {confirmDeletionLabel}>
+    confirmDeletionLabel={confirmDeletionLabel}>

Likely an incorrect or invalid review comment.

Comment on lines +54 to +66
function createFilterableColumns(columns: Column[], selected: string[] = []): Column[] {
const idColumn = [{ id: '$id', title: '$id', type: 'string' as ColumnType }].filter(
(col) => !selected.includes(col.id)
);

const systemColumns = [
{ id: '$createdAt', title: '$createdAt', type: 'datetime' as ColumnType },
{ id: '$updatedAt', title: '$updatedAt', type: 'datetime' as ColumnType }
].filter((col) => !!selected.includes(col.id));

return [...idColumn, ...columns.filter((column) => !column.isAction), ...systemColumns];
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Action columns are no longer filtered out (isAction lost in mapping).

createFilterableColumns relies on column.isAction, but createTableColumns doesn’t carry this flag over, so action columns will leak into Filters.

Apply one of the following:

  • Preserve isAction in the mapping (preferred; update the type if needed):
function createTableColumns(columns: Columns[], selected: string[] = []): Column[] {
    return columns.map((column) => ({
        id: column.key,
        title: column.key,
        type: column.type as ColumnType,
        hide: !!selected?.includes(column.key),
        array: column?.array,
        format: 'format' in column && column?.format === 'enum' ? column.format : null,
        elements: 'elements' in column ? column.elements : null,
        // ensure this is in Column type: isAction?: boolean
        isAction: (column as any)?.isAction === true
    }));
}
  • Or filter before mapping:
const raw = $table.columns.filter((c) => !c.isAction);
const freshColumns = createTableColumns(raw, selected);
🤖 Prompt for AI Agents
In
src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/+page.svelte
around lines 54-66, createFilterableColumns uses column.isAction but
createTableColumns drops that flag during mapping; preserve isAction when
mapping (and update the Column type to include isAction?: boolean) so action
columns remain marked and will be filtered out, or alternatively filter out
action columns from the source before mapping (e.g., $table.columns.filter(c =>
!c.isAction) then call createTableColumns) — choose the preserve-isAction
approach as preferred and ensure hide/other properties remain unchanged.

Comment on lines +75 to +83
const relatedColumn = $derived(
requiresTwoWayConfirm ? getAsRelationship(selectedColumns[0]) : undefined
);

const confirmDeletionLabel = $derived(
!requiresTwoWayConfirm
? 'I understand and confirm'
: `Delete relationship between ${relatedColumn.key} to ${relatedColumn.twoWayKey}`
);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Fix two‑way label selection to avoid wrong column and runtime crash

requiresTwoWayConfirm can be true even when selectedColumns[0] isn’t the two‑way relationship (or is a string). Accessing relatedColumn.key in that case will be incorrect and can throw. Find the actual two‑way relationship column instead, and fix the label grammar (“between … and …”).

Apply this diff:

-    const relatedColumn = $derived(
-        requiresTwoWayConfirm ? getAsRelationship(selectedColumns[0]) : undefined
-    );
-
-    const confirmDeletionLabel = $derived(
-        !requiresTwoWayConfirm
-            ? 'I understand and confirm'
-            : `Delete relationship between ${relatedColumn.key} to ${relatedColumn.twoWayKey}`
-    );
+    const twoWayColumn = $derived(
+        selectedColumns.find(
+            (c): c is Models.ColumnRelationship =>
+                typeof c !== 'string' && isRelationship(c) && c.twoWay
+        )
+    );
+
+    const confirmDeletionLabel = $derived(
+        twoWayColumn
+            ? `Delete relationship between ${twoWayColumn.key} and ${twoWayColumn.twoWayKey}`
+            : 'I understand and confirm'
+    );

Note: If you adopt this, getAsRelationship becomes unused and can be removed.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const relatedColumn = $derived(
requiresTwoWayConfirm ? getAsRelationship(selectedColumns[0]) : undefined
);
const confirmDeletionLabel = $derived(
!requiresTwoWayConfirm
? 'I understand and confirm'
: `Delete relationship between ${relatedColumn.key} to ${relatedColumn.twoWayKey}`
);
const twoWayColumn = $derived(
selectedColumns.find(
(c): c is Models.ColumnRelationship =>
typeof c !== 'string' && isRelationship(c) && c.twoWay
)
);
const confirmDeletionLabel = $derived(
twoWayColumn
? `Delete relationship between ${twoWayColumn.key} and ${twoWayColumn.twoWayKey}`
: 'I understand and confirm'
);

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/routes/(console)/organization-[organization]/billing/planSummary.svelte (1)

319-325: Fix reactive order and NaN risk in credits/total computation

As written, totalAmount computes before creditsApplied (top-to-bottom reactive order in Svelte), and availableCredit can be undefined. This can yield NaN and a stale first render. Compute credits first, coalesce availableCredit, and use plan price consistently.

Apply:

@@
-    $: billingData = getBillingData(currentPlan, currentAggregation, $isSmallViewport);
-
-    $: totalAmount = Math.max(currentPlan?.price - creditsApplied, 0);
-
-    $: creditsApplied = Math.min(
-        currentAggregation?.amount ?? currentPlan?.price ?? 0,
-        availableCredit
-    );
+    $: billingData = getBillingData(currentPlan, currentAggregation, $isSmallViewport);
+    // Compute credits before total; handle undefineds
+    $: planPrice = nextPlan?.price ?? currentPlan?.price ?? 0;
+    $: creditsApplied = Math.min(
+        currentAggregation?.amount ?? planPrice,
+        availableCredit ?? 0
+    );
+    $: totalAmount = Math.max(planPrice - creditsApplied, 0);
🧹 Nitpick comments (1)
src/routes/(console)/organization-[organization]/billing/planSummary.svelte (1)

454-476: Drop redundant expandable={false} on summary cells; avoid duplicate row id

  • ExpandableTable.Cell likely defaults to non-expandable; the explicit expandable={false} is noise.
  • Both summary rows use id="total-row". Even if mapped to a data-attribute, duplicate identifiers can confuse DOM/tests. Rename the credits row id.

Apply:

-                    <ExpandableTable.Row {root} id="total-row" expandable={false}>
+                    <ExpandableTable.Row {root} id="credits-row" expandable={false}>
-                        <ExpandableTable.Cell {root} column="item" expandable={false}>
+                        <ExpandableTable.Cell {root} column="item">
...
-                        <ExpandableTable.Cell {root} column="usage" expandable={false}>
+                        <ExpandableTable.Cell {root} column="usage">
...
-                        <ExpandableTable.Cell {root} column="price" expandable={false}>
+                        <ExpandableTable.Cell {root} column="price">

And:

-                <ExpandableTable.Row {root} id="total-row" expandable={false}>
+                <ExpandableTable.Row {root} id="total-row" expandable={false}>
-                    <ExpandableTable.Cell {root} column="item" expandable={false}>
+                    <ExpandableTable.Cell {root} column="item">
...
-                    <ExpandableTable.Cell {root} column="usage" expandable={false}>
+                    <ExpandableTable.Cell {root} column="usage">
...
-                    <ExpandableTable.Cell {root} column="price" expandable={false}>
+                    <ExpandableTable.Cell {root} column="price">

Also applies to: 480-494

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between f411af7 and 8809d3a.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (2)
  • package.json (2 hunks)
  • src/routes/(console)/organization-[organization]/billing/planSummary.svelte (4 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • package.json
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: build
  • GitHub Check: e2e
🔇 Additional comments (1)
src/routes/(console)/organization-[organization]/billing/planSummary.svelte (1)

363-363: No changes needed: ExpandableTable.Cell supports the expandable prop
Verified in node_modules/@appwrite.io/pink-svelte/dist/expandable-table/cell/Cell.svelte that export let expandable = true is declared.

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