-
Notifications
You must be signed in to change notification settings - Fork 272
fix(appwrite): correct import to use tablesDB instead of databases #2333
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
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);
appwrite.ioProject ID: Note Appwrite has a Discord community with over 16 000 members. |
The preview deployment failed. 🔴 Last updated at: 2025-08-30 06:45:44 CET |
WalkthroughUpdates 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
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
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this 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 toexport let data
. Otherwise, ensure all steps use$props()
consistently.References: Svelte $props docs; SvelteKit load data shows
$props()
for pages and notes Svelte 4 usedexport 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.
📒 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 underdata
. Confirm the SDK returnsidea.$id
/idea.title
as used here; adjust toidea._id
and/oridea.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
(fromnew 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)
Summary
This PR fixes an incorrect Appwrite import that caused runtime errors.
Changes
appwrite.js
to correctly export:-Replaced all invalid imports of:
import { databases } from '$lib/appwrite';
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