Skip to content

Conversation

HarshMN2345
Copy link
Member

@HarshMN2345 HarshMN2345 commented Sep 7, 2025

What does this PR do?

Add a “create more” toggle to createColumn.svelte that can be bound.
workking same as create more in create row form

Test Plan

image

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?

yes

Summary by CodeRabbit

  • New Features

    • Added a “Create more” toggle in the Create Column panel so you can add multiple columns in sequence — when enabled the form resets after each successful creation and the panel stays open.
    • Create panel no longer closes when clicking outside (prevents accidental dismissals).
    • The “Create more” toggle resets when the panel is closed.
  • Bug Fixes

    • After a failed column creation, the panel remains open so you can correct and retry quickly.

@HarshMN2345 HarshMN2345 self-assigned this Sep 7, 2025
Copy link

appwrite bot commented Sep 7, 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.

Copy link
Contributor

coderabbitai bot commented Sep 7, 2025

Walkthrough

Adds a new public boolean prop createMore to createColumn.svelte (default false) and changes submit() to return a boolean (Promise) indicating whether the side sheet should remain open (returns true to keep open after success or on error, false to close). +layout.svelte adds local state createMoreColumns bound via bind:createMore={createMoreColumns}, imports Selector from @appwrite.io/pink-svelte, renders a Selector.Switch labeled "Create more" in the Create Column sheet footer, sets closeOnBlur to false, simplifies the Create button to onClick: async () => await createColumn?.submit(), and resets createMoreColumns when the sheet is closed.

Suggested reviewers

  • ItzNotABug
  • ChiragAgg5k

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9eaedc6 and 13a00d0.

📒 Files selected for processing (1)
  • src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/+layout.svelte (4 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/+layout.svelte
⏰ 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: e2e
  • GitHub Check: build
✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat-SER-338-add-create-more-for-columns

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.

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

🧹 Nitpick comments (3)
src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/createColumn.svelte (1)

154-159: Confirm SideSheet boolean contract; add explicit return type.

The keep-open/close behavior hinges on SideSheet consuming the boolean your submit() returns. Please confirm SideSheet’s submit.onClick respects a resolved boolean (true = keep open, false = close). Also, make the return type explicit for clarity.

Apply this diff to type the API:

-export async function submit() {
+export async function submit(): Promise<boolean> {

To verify SideSheet behavior, run:

#!/bin/bash
# Inspect SideSheet API and footer support
fd -a -i "sidesheet.svelte" | while read -r f; do
  echo "== $f =="
  rg -n -C3 -P 'export\s+let\s+submit' "$f"
  rg -n -C3 -P '{#snippet\s+footer\(\)}|slot="footer"' "$f"
done

Also applies to: 165-165

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

66-74: Optional: persist the “Create more” toggle.

Consider persisting createMoreColumns in preferences (keyed per table) to retain the user’s choice across sessions.


346-348: Guard against double-submit and surface loading state on the Create button.

Prevent accidental duplicate column creations and reflect loading in disabled.

Apply this diff:

-    submit={{
-        text: 'Create',
-        onClick: async () => await createColumn?.submit(),
-        disabled: !selectedOption
-    }}>
+    submit={{
+        text: 'Create',
+        onClick: async () => {
+            if (isCreatingColumn) return true; // keep open; debounce
+            isCreatingColumn = true;
+            try {
+                return await createColumn?.submit();
+            } finally {
+                isCreatingColumn = false;
+            }
+        },
+        disabled: isCreatingColumn || !selectedOption
+    }}>

Add the flag near other locals:

 let selectedOption: Option['name'] = 'String';
 let createMoreColumns = false;
+let isCreatingColumn = false;
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6746917 and ac301bb.

📒 Files selected for processing (2)
  • src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/+layout.svelte (3 hunks)
  • src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/createColumn.svelte (3 hunks)
⏰ 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 (4)
src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/createColumn.svelte (1)

22-23: Prop looks good and is correctly typed/bindable.

createMore integrates cleanly with the component API and matches the layout binding.

Also applies to: 31-31

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

55-55: Import of Selector is correct.

Matches usage of <Selector.Switch />.


360-360: Binding createMore is correct.

Two-way binding aligns with the new prop and the switch state.


349-357: Verify SideSheet supports the footer snippet.

You’re using {#snippet footer()}; ensure SideSheet exposes a footer snippet/slot. If not, this block won’t render.

Run:

#!/bin/bash
fd -a -i "sidesheet.svelte" | xargs -I{} rg -n -C2 -P '{#snippet\s+footer\(\)}|slot="footer"' {}

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: 1

♻️ Duplicate comments (1)
src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/+layout.svelte (1)

73-77: Resolved: reset the “create more” toggle on sheet close

The reactive reset addresses the prior note about clearing the flag on close. Looks good.

🧹 Nitpick comments (2)
src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/+layout.svelte (2)

344-344: Consider making close-on-blur conditional on the “create more” toggle

Setting closeOnBlur={false} unconditionally makes this sheet behave differently from the others. If the goal is to prevent accidental closes only when “Create more” is enabled, gate it off the toggle:

-    closeOnBlur={false}
+    closeOnBlur={!createMoreColumns}

Please confirm the intended UX relative to other SideSheets.


353-360: Minor: add a test id for the switch

Helps E2E tests target this control without brittle selectors.

-            <Selector.Switch
+            <Selector.Switch
                 id="create-more-columns"
+                data-testid="create-more-columns"
                 bind:checked={createMoreColumns}
                 label="Create more" />
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ac301bb and 9eaedc6.

📒 Files selected for processing (1)
  • src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/+layout.svelte (3 hunks)
⏰ 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 (2)
src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/+layout.svelte (2)

364-364: LGTM: clean two-way binding to the child prop

The bind:createMore={createMoreColumns} wiring is straightforward and matches the new flow.


350-350: Confirm CreateColumn.submit() return type drives SideSheet closing

SideSheet’s built-in submit handler awaits your onClick value (boolean | void | Promise<boolean | void>) and closes the sheet on any falsy return. Verify that createColumn.submit() returns true to keep it open; if it returns void or false, the sheet will close. If you need explicit control, adjust the handler:

-        onClick: async () => await createColumn?.submit(),
+        onClick: async () => {
+            const keepOpen = await createColumn?.submit();
+            if (!keepOpen) $showCreateColumnSheet.show = false;
+            return keepOpen;
+        },

@ItzNotABug ItzNotABug merged commit 8eeae54 into main Sep 8, 2025
5 checks passed
@ItzNotABug ItzNotABug deleted the feat-SER-338-add-create-more-for-columns branch September 8, 2025 05:43
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