Skip to content

Conversation

ArnabChatterjee20k
Copy link
Contributor

@ArnabChatterjee20k ArnabChatterjee20k commented Sep 18, 2025

What does this PR do?

Screencast.from.2025-09-18.16-21-04.webm

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.)

Copy link

appwrite bot commented Sep 18, 2025

Console

Project ID: 688b7bf400350cbd60e9

Sites (2)
Site Status Logs Preview QR
 console-stage
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 18, 2025

Walkthrough

Adds an editing?: boolean prop to line.svelte, point.svelte, and polygon.svelte, with onMount logic to initialize state when not editing: reset savedDefault using getDefaultSpatialData for the respective geometry, set defaultChecked to false, and clear $required. Updates prop destructuring to include editing (defaulting to false where noted). In spreadsheet.svelte, adds a null guard for spatial cells so only non-null spatial values are stringified. In store.ts, adjusts getDefaultSpatialData for polygon to return a single ring instead of two. No other public API changes beyond the new editing prop in the three components.

Possibly related PRs

  • Spatial type attributes #2338: Also modifies spatial column components and shared spatial helpers, overlapping with point/line/polygon components and getDefaultSpatialData.

Suggested reviewers

  • ItzNotABug
  • HarshMN2345

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title "Create spatial col fix" is related to the changeset because the PR modifies spatial column behavior across point/line/polygon components, spreadsheet rendering, and default polygon data, so it points to the correct area of change. It is concise and highlights the general intent but is somewhat grammatically awkward and not specific about whether it fixes creation, defaults, or editing behavior. Under the provided criteria this counts as related and acceptable as a short summary of the main change.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch update-spatial-col-fix

Tip

👮 Agentic pre-merge checks are now available in preview!

Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.

  • Built-in checks – Quickly apply ready-made checks to enforce title conventions, require pull request descriptions that follow templates, validate linked issues for compliance, and more.
  • Custom agentic checks – Define your own rules using CodeRabbit’s advanced agentic capabilities to enforce organization-specific policies and workflows. For example, you can instruct CodeRabbit’s agent to verify that API documentation is updated whenever API schema files are modified in a PR. Note: Upto 5 custom checks are currently allowed during the preview period. Pricing for this feature will be announced in a few weeks.

Please see the documentation for more information.

Example:

reviews:
  pre_merge_checks:
    custom_checks:
      - name: "Undocumented Breaking Changes"
        mode: "warning"
        instructions: |
          Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).

Please share your feedback with us on this Discord post.


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

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)/project-[region]-[project]/databases/database-[database]/table-[table]/columns/polygon.svelte (1)

85-94: Fix polygon point deletion: preserve ring closure and min vertices

Current logic removes the closing coord and can leave an open/invalid ring. Delete the last non‑closing point and re‑close the ring; also guard the minimum (3 distinct points + closing).

-    function deleteCoordinate(ringIndex: number) {
-        const ring = data.default?.at(ringIndex);
-
-        ring.splice(ring.length - 1, 1);
-        if (ring.length === 0) {
-            data.default.splice(ringIndex, 1);
-        }
-
-        data.default = [...(data.default || [])];
-    }
+    function deleteCoordinate(ringIndex: number) {
+        const ring = data.default?.[ringIndex];
+        if (!ring) return;
+        // Keep at least 3 distinct points (+ closing point)
+        if (ring.length <= 4) return;
+        // Remove last non-closing point, then re-close the ring
+        ring.splice(ring.length - 2, 1);
+        ring[ring.length - 1] = [...ring[0]];
+        data.default = [...(data.default || [])];
+    }
🧹 Nitpick comments (2)
src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/spreadsheet.svelte (1)

922-926: Guard undefined spatial values to avoid blank cells

JSON.stringify(undefined) yields undefined (no output). Use a nullish check so undefined falls through to the generic renderer that shows a NULL badge.

-                                {:else if isSpatialType(rowColumn) && row[columnId] !== null}
+                                {:else if isSpatialType(rowColumn) && row[columnId] != null}
src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/columns/point.svelte (1)

49-50: Default editing=false for consistency with line/polygon

Set a default to match the other components and avoid treating an explicit false differently from undefined.

-    let { data = { required: false, default: null }, editing }: Props = $props();
+    let { data = { required: false, default: null }, editing = false }: Props = $props();
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between beb149e and 255c73a.

📒 Files selected for processing (5)
  • src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/columns/line.svelte (2 hunks)
  • src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/columns/point.svelte (2 hunks)
  • src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/columns/polygon.svelte (2 hunks)
  • src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/spreadsheet.svelte (1 hunks)
  • src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/store.ts (0 hunks)
💤 Files with no reviewable changes (1)
  • src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/store.ts
⏰ 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]/columns/line.svelte (2)

46-51: New editing prop looks good; ensure parent wiring

Prop addition and default value are sensible. Verify callers pass editing={true} for the update flow; default false will correctly treat “create” flow.


96-102: Create-mode init is correct

Resetting savedDefault/defaultChecked/$required only when not editing prevents clobbering existing column configs.

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

86-92: Create-mode init matches the pattern

Same behavior as line/polygon; good consistency.

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

107-113: Create-mode init is correct

Mirrors line/point and avoids overwriting when editing.

Copy link
Member

Choose a reason for hiding this comment

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

we might have to inline all these 3 into one component someday for reuse, the logic looks mostly the same to me at JS side atleast!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I started with this approach only but a lot of mess due to the data structure and functions underlying -> leading to handling of the patterns similar to three files

@abnegate abnegate merged commit aa6326f into main Sep 18, 2025
5 checks passed
@abnegate abnegate deleted the update-spatial-col-fix branch September 18, 2025 11:07
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.

3 participants