Skip to content

Conversation

@HarshMN2345
Copy link
Member

@HarshMN2345 HarshMN2345 commented Jan 7, 2026

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

  • Refactor
    • Organization page data loading updated to adapt project lists by deployment type, ensuring active and archived projects are shown or omitted appropriately.
    • Non-applicable query results are now returned as lightweight placeholders to improve load behavior and responsiveness.

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

@appwrite
Copy link

appwrite bot commented Jan 7, 2026

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

Global CDN and DDoS protection come free with every Sites deployment

@HarshMN2345 HarshMN2345 requested a review from ItzNotABug January 7, 2026 07:50
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 7, 2026

Walkthrough

A single file was modified to introduce conditional query execution based on an isCloud flag. When isCloud is true, the original set of four project-list queries (active, archived, and their type-filtered variants) execute via Promise.all. When isCloud is false, the second and fourth queries are replaced with resolved placeholder objects containing empty projects with a total of 0, while the first and third queries are adjusted to remove status-based filters. This conditional branching alters the query parameters and result structure depending on the environment type.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

🚥 Pre-merge checks | ✅ 3
✅ 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 accurately reflects the main change: conditionally skipping the active/status filter query for self-hosted instances by branching on an isCloud flag.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

📜 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 8aa8dab and b5d5bb0.

📒 Files selected for processing (1)
  • src/routes/(console)/organization-[organization]/+page.ts
🧰 Additional context used
📓 Path-based instructions (4)
**/*.{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)/organization-[organization]/+page.ts
**/*.ts

📄 CodeRabbit inference engine (AGENTS.md)

**/*.ts: Define types inline or in .d.ts files, avoid creating separate .types.ts files
Use TypeScript in non-strict mode; any type is tolerated in this project

Files:

  • src/routes/(console)/organization-[organization]/+page.ts
**/*.{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)/organization-[organization]/+page.ts
src/routes/**

📄 CodeRabbit inference engine (AGENTS.md)

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

Files:

  • src/routes/(console)/organization-[organization]/+page.ts
🧬 Code graph analysis (1)
src/routes/(console)/organization-[organization]/+page.ts (1)
src/lib/system.ts (1)
  • isCloud (26-26)
⏰ 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
🔇 Additional comments (5)
src/routes/(console)/organization-[organization]/+page.ts (5)

2-2: LGTM: Import follows project conventions.

The import correctly uses the $lib alias as per coding guidelines and brings in the isCloud flag needed for conditional query execution.


27-30: LGTM: Clean refactor to reduce query duplication.

The introduction of common and active filter arrays effectively reduces code duplication. The conditional logic correctly skips status-based filtering for self-hosted instances where the status attribute is unavailable.


32-65: LGTM: Conditional query execution achieves PR objective.

The implementation correctly branches query execution based on isCloud:

  • Cloud instances: Execute all 4 queries with status-based filters
  • Self-hosted instances: Skip archived project queries and omit status filters from active queries

The use of placeholder objects maintains the expected destructuring pattern while avoiding unnecessary API calls for self-hosted environments.


71-75: LGTM: Defensive conditional for archived projects.

The conditional check appropriately skips region defaulting for archived projects in non-cloud instances, where archivedProjects.projects will be an empty array. This is a minor optimization that avoids unnecessary iteration.


43-54: Verify placeholder object type compatibility.

The placeholder objects { projects: [], total: 0 } returned for non-cloud instances should match the return type of sdk.forConsole.projects.list(). While the structure appears correct, please verify type compatibility to avoid runtime issues.

Run the following to check the return type definition:

#!/bin/bash
# Description: Find the return type of projects.list method

# Search for the projects.list type definition
ast-grep --pattern 'list($$$): $RET'

# Also check for ProjectsList or similar type definitions
rg -n "type.*Projects.*List|interface.*Projects.*List" --type ts -A5

Also applies to: 59-64


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 (2)
src/routes/(console)/organization-[organization]/+page.ts (2)

85-90: Minor optimization opportunity: Skip archived projects loop for non-cloud.

The loop at lines 88-90 iterates over archivedProjects.projects, which will always be an empty array for self-hosted instances. While this is harmless (iterating over an empty array is a no-op), you could add a conditional to skip it for non-cloud environments:

♻️ Optional optimization
 for (const project of activeProjects.projects) {
     project.region ??= 'default';
 }
-for (const project of archivedProjects.projects) {
-    project.region ??= 'default';
-}
+if (isCloud) {
+    for (const project of archivedProjects.projects) {
+        project.region ??= 'default';
+    }
+}

27-82: The code properly differentiates between cloud and self-hosted environments.

The conditional logic correctly skips status-based queries for self-hosted instances, which aligns with the architectural design where self-hosted deployments follow a different data model. The placeholder structure { projects: [], total: 0 } correctly matches the expected response type used in the return object (accessing .projects and .total properties).

Consider refactoring to reduce duplication: The cloud branch contains four nearly identical queries with only status filters varying. Extracting common query construction into helper functions would improve maintainability without changing behavior.

📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 63ebeaf and 8aa8dab.

📒 Files selected for processing (1)
  • src/routes/(console)/organization-[organization]/+page.ts
🧰 Additional context used
📓 Path-based instructions (4)
**/*.{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)/organization-[organization]/+page.ts
**/*.ts

📄 CodeRabbit inference engine (AGENTS.md)

**/*.ts: Define types inline or in .d.ts files, avoid creating separate .types.ts files
Use TypeScript in non-strict mode; any type is tolerated in this project

Files:

  • src/routes/(console)/organization-[organization]/+page.ts
**/*.{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)/organization-[organization]/+page.ts
src/routes/**

📄 CodeRabbit inference engine (AGENTS.md)

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

Files:

  • src/routes/(console)/organization-[organization]/+page.ts
🧬 Code graph analysis (1)
src/routes/(console)/organization-[organization]/+page.ts (1)
src/lib/system.ts (1)
  • isCloud (26-26)
⏰ 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
🔇 Additional comments (1)
src/routes/(console)/organization-[organization]/+page.ts (1)

2-2: LGTM!

The isCloud import follows the project's convention of using the $lib alias for module imports.

- Conditionally fetch projects based on isCloud flag
- Skip archived projects loop and queries for non-cloud environments
- Optimize query construction to reduce duplication
@HarshMN2345 HarshMN2345 requested a review from Meldiron January 7, 2026 08:01
Copy link
Contributor

@Meldiron Meldiron left a comment

Choose a reason for hiding this comment

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

LGTM, works locally

Image

@HarshMN2345 HarshMN2345 merged commit 838a5b2 into main Jan 7, 2026
4 checks passed
@HarshMN2345 HarshMN2345 deleted the fix-skip-filter-by-status-for-selfhosted branch January 7, 2026 13:15
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.

4 participants