Skip to content

Fix: code examples#15

Merged
Meldiron merged 1 commit intomainfrom
fix-code-examles
Mar 5, 2026
Merged

Fix: code examples#15
Meldiron merged 1 commit intomainfrom
fix-code-examles

Conversation

@Meldiron
Copy link
Contributor

@Meldiron Meldiron commented Mar 4, 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

  • New Features

    • Added success notifications and error messages to tutorial panels for improved user feedback.
  • Updates

    • Updated tutorial examples to reflect the latest SDK features and best practices.

@appwrite
Copy link

appwrite bot commented Mar 4, 2026

Appwrite Arena

Project ID: appwrite-arena

Sites (1)
Site Status Logs Preview QR
 Arena
arena
Ready Ready View Logs Preview URL QR Code

Tip

Sites support three domain rule types: Active deployment, Git branch, and Redirect

@coderabbitai
Copy link

coderabbitai bot commented Mar 4, 2026

Walkthrough

This pull request adds biome-ignore lint suppression comments to five React components to bypass linting rules for accessibility and uniqueness checks. Additionally, TwoModes.tsx introduces explicit type annotations for the PANELS configuration object, expands the data structure with optional success and error fields, updates panel content to reflect newer SDK usage, and adds conditional UI rendering for the new success banner and error list fields. ModelDetailPage updates the useEffect dependency array to include the setFilter callback.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~15 minutes

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title 'Fix: code examples' is vague and does not accurately reflect the primary changes. The changeset includes biome-ignore lint comments across multiple components, type annotations for the PANELS configuration, and a dependency array update. 'Code examples' specifically references only the TwoModes.tsx changes but ignores the broader scope of lint suppressions and other modifications. Provide a more specific title that captures the main objective, such as 'Add biome-ignore comments and improve PANELS type safety' or clarify if the PR's primary goal is addressing code examples or addressing lint warnings.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

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

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix-code-examles

Tip

Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs).
Share your feedback on Discord.


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

@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: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/components/charts/RadarPerformance.tsx (1)

148-160: ⚠️ Potential issue | 🟠 Major

Don’t suppress this: legend control is not keyboard-operable.

Line 160 has a no-op key handler, so keyboard users can focus but not activate reliably. Please replace the interactive span with a real button instead of suppressing the rule.

Suggested fix
- // biome-ignore lint/a11y/useSemanticElements: interactive legend item within recharts
- <span
+ <button
+   type="button"
    key={item.value}
-   role="button"
-   tabIndex={0}
    onClick={() =>
      onLegendClick?.({
        value: item.value,
      } as never)
    }
    onMouseEnter={() => setHoveredModel(item.value as string)}
    onMouseLeave={() => setHoveredModel(null)}
-   onKeyDown={() => {}}
    style={{
      display: "inline-flex",
      alignItems: "center",
      gap: 6,
+     background: "transparent",
+     border: 0,
+     padding: 0,
    }}
- >
+ >
   ...
- </span>
+ </button>
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/components/charts/RadarPerformance.tsx` around lines 148 - 160, Replace
the non-semantic interactive span with a real <button type="button"> element
(remove the biome-ignore lint and role="button" and tabIndex) so keyboard users
can activate the legend natively; keep the existing props and handlers
(key={item.value}, onClick={() => onLegendClick?.({ value: item.value } as
never)}, onMouseEnter={() => setHoveredModel(item.value as string)},
onMouseLeave={() => setHoveredModel(null)}) and ensure styling is preserved so
it looks identical to the previous span while relying on the button's built-in
keyboard activation instead of the no-op onKeyDown.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/components/TwoModes.tsx`:
- Around line 193-196: The map over panel.errors in TwoModes.tsx uses
key={error}, which can collide when messages repeat; update the map callback
(panel.errors.map) to use a stable unique key per item instead—prefer using a
stable identifier (e.g., an error.id if errors are objects) or combine the panel
identifier with the item index (e.g., `${panel.id}-${index}`) so each rendered
<div> has a unique key and avoids React key collisions.
- Around line 124-136: The sample SDK code in the TwoModes.tsx snippet uses the
wrong property name for table rows; update the TablesDB.createRow call to use
rowId instead of documentId (keep the ID.unique() usage) so the call matches the
Appwrite Web SDK signature (refer to the TablesDB.createRow invocation and the
ID.unique() usage in the snippet).

---

Outside diff comments:
In `@src/components/charts/RadarPerformance.tsx`:
- Around line 148-160: Replace the non-semantic interactive span with a real
<button type="button"> element (remove the biome-ignore lint and role="button"
and tabIndex) so keyboard users can activate the legend natively; keep the
existing props and handlers (key={item.value}, onClick={() => onLegendClick?.({
value: item.value } as never)}, onMouseEnter={() => setHoveredModel(item.value
as string)}, onMouseLeave={() => setHoveredModel(null)}) and ensure styling is
preserved so it looks identical to the previous span while relying on the
button's built-in keyboard activation instead of the no-op onKeyDown.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 5b8a8fdd-2e32-49f6-816c-6fc95c9700ea

📥 Commits

Reviewing files that changed from the base of the PR and between 3e8267b and 55bed2d.

📒 Files selected for processing (6)
  • src/components/Footer.tsx
  • src/components/HeroSection.tsx
  • src/components/HowItWorks.tsx
  • src/components/TwoModes.tsx
  • src/components/charts/RadarPerformance.tsx
  • src/routes/model/$modelId.tsx

Comment on lines +124 to 136
code: `import { Client, TablesDB, ID } from 'appwrite';

const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1')
.setProject('<PROJECT_ID>');

const databases = new Databases(client);
await databases.createDocument({
const tables = new TablesDB(client);
await tables.createRow({
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
tableId: '<TABLE_ID>',
documentId: ID.unique(),
data: { title: 'Hello', content: 'World' }
});`,
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🌐 Web query:

Appwrite Web SDK TablesDB.createRow method signature documentation

💡 Result:

Appwrite Web SDK TablesDB.createRow (TypeScript) signature

Preferred (object-params) overload:

createRow<Row extends Models.Row = Models.DefaultRow>(params: {
  databaseId: string;
  tableId: string;
  rowId: string;
  data: Row extends Models.DefaultRow
    ? Partial<Models.Row> & Record<string, any>
    : Partial<Models.Row> & Omit<Row, keyof Models.Row>;
  permissions?: string[];
  transactionId?: string;
}): Promise<Row>;

[1]

Deprecated (positional-params) overload:

createRow<Row extends Models.Row = Models.DefaultRow>(
  databaseId: string,
  tableId: string,
  rowId: string,
  data: Row extends Models.DefaultRow
    ? Partial<Models.Row> & Record<string, any>
    : Partial<Models.Row> & Omit<Row, keyof Models.Row>,
  permissions?: string[],
  transactionId?: string
): Promise<Row>;

[1]

Parameter meanings (rowId/data/permissions/transactionId) match the TablesDB “Create row” API reference. [2]

Sources: [1] Web SDK implementation (src/services/tables-db.ts) [2] TablesDB API reference (“Create row”).


Fix SDK example: use rowId instead of documentId.

Line 134 uses documentId in the TablesDB.createRow example, but the Appwrite Web SDK expects rowId. This will cause the sample code to fail when users copy-paste it.

Correction
 await tables.createRow({
   databaseId: '<DATABASE_ID>',
   tableId: '<TABLE_ID>',
-  documentId: ID.unique(),
+  rowId: ID.unique(),
   data: { title: 'Hello', content: 'World' }
 });
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/components/TwoModes.tsx` around lines 124 - 136, The sample SDK code in
the TwoModes.tsx snippet uses the wrong property name for table rows; update the
TablesDB.createRow call to use rowId instead of documentId (keep the ID.unique()
usage) so the call matches the Appwrite Web SDK signature (refer to the
TablesDB.createRow invocation and the ID.unique() usage in the snippet).

Comment on lines +193 to +196
{panel.errors.map((error) => (
<div
key={error}
className="flex items-start gap-1.5 rounded-md border border-red-200 bg-red-50 px-2 py-1.5 font-mono text-[10px] leading-tight text-red-600"
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

key={error} can collide for duplicate messages.

Line 195 should use a stable unique key per item; duplicate error strings will produce duplicate React keys.

Suggested fix
- {panel.errors.map((error) => (
+ {panel.errors.map((error, idx) => (
     <div
-      key={error}
+      key={`${panel.label}-${idx}-${error}`}
       className="flex items-start gap-1.5 rounded-md border border-red-200 bg-red-50 px-2 py-1.5 font-mono text-[10px] leading-tight text-red-600"
     >
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
{panel.errors.map((error) => (
<div
key={error}
className="flex items-start gap-1.5 rounded-md border border-red-200 bg-red-50 px-2 py-1.5 font-mono text-[10px] leading-tight text-red-600"
{panel.errors.map((error, idx) => (
<div
key={`${panel.label}-${idx}-${error}`}
className="flex items-start gap-1.5 rounded-md border border-red-200 bg-red-50 px-2 py-1.5 font-mono text-[10px] leading-tight text-red-600"
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/components/TwoModes.tsx` around lines 193 - 196, The map over
panel.errors in TwoModes.tsx uses key={error}, which can collide when messages
repeat; update the map callback (panel.errors.map) to use a stable unique key
per item instead—prefer using a stable identifier (e.g., an error.id if errors
are objects) or combine the panel identifier with the item index (e.g.,
`${panel.id}-${index}`) so each rendered <div> has a unique key and avoids React
key collisions.

@Meldiron Meldiron merged commit 152206d into main Mar 5, 2026
2 checks passed
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