Skip to content

Conversation

kamatealif
Copy link

@kamatealif kamatealif commented Aug 30, 2025

Summary

This PR fixes an incorrect Appwrite import that caused runtime errors.

Changes

  • Updated appwrite.js to correctly export:
    export const tablesDB = new TablesDB(client);

-Replaced all invalid imports of:

import { databases } from '$lib/appwrite';

  • with :
    import { tablesDB } from '$lib/appwrite';

why

The Appwrite SDK no longer provides a databases export.
Instead, the correct class is TablesDB, which must be instantiated and exported as tablesDB.
Without this fix, the code attempted to import a non-existent databases object, leading to errors when accessing the database.

Additional Notes

No breaking changes to functionality, just corrected the import/export.

Code is now aligned with the latest Appwrite SDK usage.

Summary by CodeRabbit

  • Documentation
    • Updated SvelteKit tutorial examples to use the new Tables database API instead of the previous database client.
    • Revised data binding in examples to use $props-based destructuring for accessing page data.
    • Clarified query behavior and result ordering in sample snippets for better accuracy.
    • Aligned terminology and examples with the latest SDK and framework patterns.

switched the data props which is coming from the parent component to use the svelte 5 runes 
changes :
export let data;
to 
let { data } = $props();
 and  this works as well
update: switched components from Svelte 4 syntax to Svelte 5
### Summary
This PR fixes an incorrect Appwrite import that caused runtime errors.

### Changes
- Updated `appwrite.js` to correctly export:
  ```js
  export const tablesDB = new TablesDB(client);
Copy link

appwrite bot commented Aug 30, 2025

appwrite.io

Project ID: 684969cb000a2f6c0a02

Sites (1)
Site Status Logs Preview QR
 website
68496a17000f03d62013
Failed Failed Authorize Preview URL QR Code

Note

Appwrite has a Discord community with over 16 000 members.

@coolify-appwrite-org
Copy link

coolify-appwrite-org bot commented Aug 30, 2025

The preview deployment failed. 🔴

Open Build Logs

Last updated at: 2025-08-30 06:45:44 CET

Copy link
Contributor

coderabbitai bot commented Aug 30, 2025

Walkthrough

Updates tutorial snippets in SvelteKit docs. In step-6, switches Appwrite usage from databases to tablesDB by updating imports and method calls (listRows, createRow, deleteRow) and adjusts getIdeas/addIdea/deleteIdea accordingly; no changes to public function signatures. In step-7, changes data binding from an exported prop to local destructuring via let { data } = $props();, altering the snippet’s public API from export let data to a local binding.

Suggested reviewers

  • abnegate
  • ItzNotABug

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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

🧹 Nitpick comments (7)
src/routes/docs/tutorials/sveltekit/step-7/+page.markdoc (4)

32-32: Confirm target Svelte version; prefer keeping tutorial consistent.

$props() is Svelte 5. If the tutorial targets Svelte 4 or wants consistency with earlier steps, revert to export let data. Otherwise, ensure all steps use $props() consistently.

References: Svelte $props docs; SvelteKit load data shows $props() for pages and notes Svelte 4 used export let data. (svelte.dev)

-	let { data } = $props();
+	export let data;

29-29: Import path consistency nit.

Earlier in this step you import without an extension ($lib/ideas). Do the same here for consistency with SvelteKit examples.

-	import { addIdea, deleteIdea } from '$lib/ideas.js';
+	import { addIdea, deleteIdea } from '$lib/ideas';

67-67: Grammar nit.

Use “log in” (verb) instead of “login” (noun).

-	<section><p>Please login to submit an idea.</p></section>
+	<section><p>Please log in to submit an idea.</p></section>

4-4: Fix typos in description.

“pagining” → “pagination”; “you” → “your”.

-description: Add pagining and ordering to you SvelteKit application powered by Appwrite Databases.
+description: Add pagination and ordering to your SvelteKit application powered by Appwrite Databases.
src/routes/docs/tutorials/sveltekit/step-6/+page.markdoc (3)

43-50: Double-check order field name for TablesDB.

Query.orderDesc('$createdAt') may need the underscore meta (_createdAt) under TablesDB. Alternatively, ordering by _sequence is a stable insertion-order option. Also ensure an index exists on the chosen column to avoid query errors.

References: Rows expose _createdAt, _sequence; ordering guidance. (appwrite.io)

-		[Query.orderDesc('$createdAt')]
+		[Query.orderDesc('_createdAt')]

65-65: Term alignment nit.

Consider “Appwrite TablesDB” or “Appwrite Databases (TablesDB)” to reflect the new API naming.

-Remember to use a store to hold data returned from Appwrite Databases, so your components can be updated when the data changes.
+Remember to use a store to hold data returned from Appwrite TablesDB, so your components update when the data change.

4-4: Grammar nit.

“you” → “your”.

-description: Add databases and queries to store user data in you SvelteKit project.
+description: Add databases and queries to store user data in your SvelteKit project.
📜 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 434e7fb and 9b6919f.

📒 Files selected for processing (2)
  • src/routes/docs/tutorials/sveltekit/step-6/+page.markdoc (2 hunks)
  • src/routes/docs/tutorials/sveltekit/step-7/+page.markdoc (1 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: tests
🔇 Additional comments (4)
src/routes/docs/tutorials/sveltekit/step-7/+page.markdoc (1)

85-86: Verify TablesDB row meta fields ($id vs _id) and attribute shape.

Under TablesDB, row meta fields may use underscores (e.g., _id, _createdAt) and attributes may live under data. Confirm the SDK returns idea.$id/idea.title as used here; adjust to idea._id and/or idea.data.title if needed.

References: TablesDB docs show row fields like _id, _createdAt, data. (appwrite.io)

-					<button type="button" on:click={() => remove(idea.$id)}>Remove</button>
+					<button type="button" on:click={() => remove(idea._id)}>Remove</button>

Also applies to: 78-84

src/routes/docs/tutorials/sveltekit/step-6/+page.markdoc (3)

38-38: LGTM: switch to TablesDB import aligns with latest SDK.

Using an instantiated tablesDB (from new TablesDB(client)) matches the new API direction. Ensure $lib/appwrite exports it accordingly.

References: TablesDB announcement; SDK examples showing new TablesDB(client). (appwrite.io)


52-59: LGTM: create row via TablesDB.

API shape and parameters look correct for client SDK usage.

References: TablesDB rows API and SDK patterns. (appwrite.io)


60-62: LGTM: delete row via TablesDB.

Matches the TablesDB API surface.

References: TablesDB rows API. (appwrite.io)

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.

1 participant