Skip to content

Conversation

@fulopkovacs
Copy link
Owner

@fulopkovacs fulopkovacs commented Jan 4, 2026

Summary by CodeRabbit

  • New Features

    • Improved code highlighting in docs
    • New links/components to open the API Requests panel from tutorials
    • Added a deep-dive article on query-driven sync
  • Documentation

    • Revised and clarified multiple tutorials and resources
    • Replaced the Optimistic Actions tutorial with the Query-driven Sync article
    • Updated links and wording for clarity
  • Bug Fixes

    • Tighter error handling to ensure rollbacks on failed mutations
  • Chores

    • Added documentation highlighting transformer and related config

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

@coderabbitai
Copy link

coderabbitai bot commented Jan 4, 2026

Walkthrough

Adds MDX line highlighting via Shiki, introduces highlight-aware tutorial links and OpenAPI panel controls, tightens collection mutation error handling by rethrowing errors, replaces the optimistic-actions deep-dive with a query-driven-sync article, and updates tutorial content and styles for highlighting.

Changes

Cohort / File(s) Summary
Config & Formatting
\.prettierignore`, `package.json`, `vite.config.ts``
Added Prettier ignore for src/data/deep-dives/*.mdx; added @shikijs/transformers dependency; enabled transformerMetaHighlight() in MDX Shiki transformer pipeline.
Styling & Highlight Wrapper
\src/styles.css`, `src/utils/highlight-collection-related-info.tsx``
Added Shiki line-highlighting CSS (grid, empty-line handling, highlighted-line visuals, theme overrides); increased HighlightWrapper z-index (z-50).
API Requests UI
\src/components/ApiPanelToggle.tsx`, `src/components/ApiRequestsPanel.tsx``
Wrapped API toggle and panel content with HighlightWrapper; reorganized ApiRequestsPanel header (badge/count, clear button) and request list structure; preserved existing behavior.
Tutorial UI & Navigation
\src/components/tutorial/index.tsx`, `src/components/tutorial/TutorialWindow.tsx``
Added HighlightLink and OpenAPIRequestsPanelLink components; extended highlight enum with networkPanel_toggle and networkPanel_panel; TutorialWindow now uses useNavigate to sync/clean article query param when selecting article from search.
Collections: Error Handling
\src/collections/projects.ts`, `src/collections/todoItems.ts``
Tightened mutation error handling: caught errors now re-thrown after logging/toast in onInsert/onUpdate paths (rollback enforced); minor comment wording tweaks.
Tutorial Content & Docs
\src/data/deep-dives/query-driven-sync.mdx`, `src/data/tutorial.ts`, `src/data/tutorial/*.mdx``
Added query-driven-sync deep-dive; removed optimistic-actions.mdx; updated tutorial imports to export OpenAPIRequestsPanelLink and LinkToArticle; multiple textual/formatting tweaks across tutorial MDX files.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant User
  participant Tutorial as TutorialLink / UI
  participant Prefs as userPreferences
  participant Router as useNavigate
  participant ApiPanel as ApiRequestsPanel
  Note over Tutorial,Prefs: User clicks OpenAPIRequestsPanelLink
  User->>Tutorial: click OpenAPIRequestsPanelLink
  Tutorial->>Prefs: set networkPanel = "open"
  Tutorial->>Router: navigate(replace, highlight=networkPanel_panel)
  Router->>ApiPanel: route/render with highlight param
  ApiPanel->>ApiPanel: HighlightWrapper applies highlight (visual)
  Note right of ApiPanel: Clear button and requests count remain functional
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Possibly related PRs

Pre-merge checks and finishing touches

❌ 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%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Title check ❓ Inconclusive The title "Update the guide's content" is vague and generic. It does not convey specific information about the primary changes in the changeset. Replace with a more specific title that highlights the main change, such as 'Add query-driven sync deep-dive and enhance tutorial content' or 'Replace optimistic actions with query-driven sync tutorial'.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing touches
  • 📝 Generate docstrings

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a8405a3 and cfabc32.

📒 Files selected for processing (1)
  • src/components/tutorial/TutorialWindow.tsx
🧰 Additional context used
📓 Path-based instructions (3)
src/**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (AGENTS.md)

Always ensure no formatting/linting issues exist in code - use pnpm check --fix to automatically fix issues

Files:

  • src/components/tutorial/TutorialWindow.tsx
**/*.{tsx,ts}

📄 CodeRabbit inference engine (AGENTS.md)

Prefer functions over arrow functions for React components

Files:

  • src/components/tutorial/TutorialWindow.tsx
**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Prefer type over interface for type definitions

Files:

  • src/components/tutorial/TutorialWindow.tsx
🧠 Learnings (2)
📚 Learning: 2025-12-24T15:25:07.106Z
Learnt from: fulopkovacs
Repo: fulopkovacs/trytanstackdb.com PR: 22
File: src/components/TodoBoards.tsx:63-81
Timestamp: 2025-12-24T15:25:07.106Z
Learning: In Tailwind CSS v4, prefer canonical classes using bg-linear-to-* (e.g., bg-linear-to-b, bg-linear-to-t, bg-linear-to-r) over the older bg-gradient-to-* syntax. This aligns with Tailwind LSP's suggestCanonicalClasses rule. Apply across TSX files (e.g., src/components/*.tsx); replace occurrences of bg-gradient-to-* with the corresponding bg-linear-to-* equivalents and verify gradients visually.

Applied to files:

  • src/components/tutorial/TutorialWindow.tsx
📚 Learning: 2025-12-28T23:34:13.416Z
Learnt from: fulopkovacs
Repo: fulopkovacs/trytanstackdb.com PR: 32
File: src/components/HomeIntro.tsx:16-25
Timestamp: 2025-12-28T23:34:13.416Z
Learning: In Motion (motion/react), when configuring variant transitions, use delayChildren: stagger(x) to create per-child delays (e.g., delayChildren: stagger(0.2)). This is different from the older API that used a separate staggerChildren property. Apply this guidance to TSX files that declare motion variants (e.g., in src/components/**/*.tsx) and verify that stagger is imported from framer-motion. Ensure transitions reflect the intended stagger timing and that no conflicting delay values override the staggered effect.

Applied to files:

  • src/components/tutorial/TutorialWindow.tsx
🧬 Code graph analysis (1)
src/components/tutorial/TutorialWindow.tsx (1)
src/utils/highlight-collection-related-info.tsx (1)
  • navigate (22-28)
⏰ 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). (1)
  • GitHub Check: Deploy Preview
🔇 Additional comments (1)
src/components/tutorial/TutorialWindow.tsx (1)

489-519: Article URL parameter handling looks good.

The implementation correctly:

  • Encodes the article parameter in CopyArticleLinkButton using encodeURIComponent(activeStep.toLowerCase())
  • Decodes and normalizes it in the effect with .toLowerCase().trim() for case-insensitive matching
  • Cleans up the URL parameter after navigation with replace: true
  • Includes all required dependencies in the effect

The console debug logging from the previous review has been removed. The navigation pattern matches the established codebase style used in HighlightWrapper.


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.

@github-actions
Copy link

github-actions bot commented Jan 4, 2026

🚀 Preview Deployment

Status: ✅ Ready!

Preview URL: Open Preview

Commit: cfabc321640899fc4ccb9399adb7462414f08d05

Built and deployed successfully

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

🧹 Nitpick comments (3)
src/data/deep-dives/query-driven-sync.mdx (1)

54-54: Optional: Consider replacing "Right now" with "Currently" for a more formal tone.

The phrase "Right now, we have only one query" could be rephrased as "Currently, we have only one query" for slightly more formal documentation style.

src/components/tutorial/index.tsx (1)

155-180: Consider adding error handling to the collection mutation.

The OpenAPIRequestsPanelLink component updates userPreferencesCollection without error handling. Given that the PR objectives mention "tightens error handling in collection mutations through re-throwing," this mutation might also benefit from error handling to prevent potential unhandled promise rejections.

🔎 Suggested enhancement with error handling
  const openThePanel = useCallback(() => {
    if (typeof window !== "undefined") {
-     userPreferencesCollection.update(USER_PLACEHOLDER.id, (draft) => {
-       draft.networkPanel = "open";
-     });
+     userPreferencesCollection.update(USER_PLACEHOLDER.id, (draft) => {
+       draft.networkPanel = "open";
+     }).catch((error) => {
+       console.error("Failed to open network panel:", error);
+     });
    }
  }, []);
src/data/tutorial/how-do-collections-work.mdx (1)

1-80: LGTM! Content refinements improve clarity.

The text updates improve consistency and readability throughout the tutorial. The terminology has been standardized (e.g., "remote data source" instead of "remote source"), and the explanations are clearer.

Note: Static analysis flagged two minor style suggestions if you'd like to polish further:

  • Line 14: Consider rewording "very simple" (commonly over-used intensifier)
  • Line 50: In American English, "etc." requires a period (should be "etc.")
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between eb7652c and a8405a3.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (18)
  • .prettierignore
  • package.json
  • src/collections/projects.ts
  • src/collections/todoItems.ts
  • src/components/ApiPanelToggle.tsx
  • src/components/ApiRequestsPanel.tsx
  • src/components/tutorial/TutorialWindow.tsx
  • src/components/tutorial/index.tsx
  • src/data/deep-dives/query-driven-sync.mdx
  • src/data/tutorial.ts
  • src/data/tutorial/collections-intro.mdx
  • src/data/tutorial/how-do-collections-work.mdx
  • src/data/tutorial/optimistic-actions.mdx
  • src/data/tutorial/optimistic-updates.mdx
  • src/data/tutorial/what-is-next.mdx
  • src/styles.css
  • src/utils/highlight-collection-related-info.tsx
  • vite.config.ts
💤 Files with no reviewable changes (1)
  • src/data/tutorial/optimistic-actions.mdx
🧰 Additional context used
📓 Path-based instructions (5)
src/**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (AGENTS.md)

Always ensure no formatting/linting issues exist in code - use pnpm check --fix to automatically fix issues

Files:

  • src/components/ApiRequestsPanel.tsx
  • src/collections/projects.ts
  • src/components/tutorial/TutorialWindow.tsx
  • src/components/ApiPanelToggle.tsx
  • src/data/tutorial.ts
  • src/utils/highlight-collection-related-info.tsx
  • src/components/tutorial/index.tsx
  • src/collections/todoItems.ts
**/*.{tsx,ts}

📄 CodeRabbit inference engine (AGENTS.md)

Prefer functions over arrow functions for React components

Files:

  • src/components/ApiRequestsPanel.tsx
  • src/collections/projects.ts
  • src/components/tutorial/TutorialWindow.tsx
  • src/components/ApiPanelToggle.tsx
  • src/data/tutorial.ts
  • vite.config.ts
  • src/utils/highlight-collection-related-info.tsx
  • src/components/tutorial/index.tsx
  • src/collections/todoItems.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Prefer type over interface for type definitions

Files:

  • src/components/ApiRequestsPanel.tsx
  • src/collections/projects.ts
  • src/components/tutorial/TutorialWindow.tsx
  • src/components/ApiPanelToggle.tsx
  • src/data/tutorial.ts
  • vite.config.ts
  • src/utils/highlight-collection-related-info.tsx
  • src/components/tutorial/index.tsx
  • src/collections/todoItems.ts
**/package.json

📄 CodeRabbit inference engine (AGENTS.md)

**/package.json: Always use pnpm install instead of npm install for installing dependencies
Always use pnpm add <package> instead of npm install <package> for adding packages
Always use pnpm add -D <package> instead of npm install --save-dev <package> for adding dev dependencies
Always use pnpm remove <package> instead of npm uninstall <package> for removing packages
Always use pnpm run <script> instead of npm run <script> for running scripts
Always use pnpm dlx <command> instead of npx <command>
Always use pnpm create <template> instead of npm create <template>

Files:

  • package.json
package.json

📄 CodeRabbit inference engine (AGENTS.md)

package.json: Use pnpm dev for starting the development server
Use pnpm build for production build
Use pnpm run test for running tests
Use pnpm lint for linting
Use pnpm typecheck for type checking
Use pnpm format for code formatting
Use pnpm db.generate to generate database migrations
Use pnpm db.local.migrate to apply local migrations
Use pnpm db.prod.migrate to apply production migrations

Files:

  • package.json
🧠 Learnings (3)
📚 Learning: 2025-12-24T15:25:07.106Z
Learnt from: fulopkovacs
Repo: fulopkovacs/trytanstackdb.com PR: 22
File: src/components/TodoBoards.tsx:63-81
Timestamp: 2025-12-24T15:25:07.106Z
Learning: In Tailwind CSS v4, prefer canonical classes using bg-linear-to-* (e.g., bg-linear-to-b, bg-linear-to-t, bg-linear-to-r) over the older bg-gradient-to-* syntax. This aligns with Tailwind LSP's suggestCanonicalClasses rule. Apply across TSX files (e.g., src/components/*.tsx); replace occurrences of bg-gradient-to-* with the corresponding bg-linear-to-* equivalents and verify gradients visually.

Applied to files:

  • src/components/ApiRequestsPanel.tsx
  • src/components/tutorial/TutorialWindow.tsx
  • src/components/ApiPanelToggle.tsx
  • src/utils/highlight-collection-related-info.tsx
  • src/components/tutorial/index.tsx
📚 Learning: 2025-12-28T23:34:13.416Z
Learnt from: fulopkovacs
Repo: fulopkovacs/trytanstackdb.com PR: 32
File: src/components/HomeIntro.tsx:16-25
Timestamp: 2025-12-28T23:34:13.416Z
Learning: In Motion (motion/react), when configuring variant transitions, use delayChildren: stagger(x) to create per-child delays (e.g., delayChildren: stagger(0.2)). This is different from the older API that used a separate staggerChildren property. Apply this guidance to TSX files that declare motion variants (e.g., in src/components/**/*.tsx) and verify that stagger is imported from framer-motion. Ensure transitions reflect the intended stagger timing and that no conflicting delay values override the staggered effect.

Applied to files:

  • src/components/ApiRequestsPanel.tsx
  • src/components/tutorial/TutorialWindow.tsx
  • src/components/ApiPanelToggle.tsx
  • src/utils/highlight-collection-related-info.tsx
  • src/components/tutorial/index.tsx
📚 Learning: 2025-12-29T13:20:08.388Z
Learnt from: CR
Repo: fulopkovacs/trytanstackdb.com PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-29T13:20:08.388Z
Learning: Applies to src/route/__root.tsx : The root route is located at `src/route/__root.tsx` in this TanStack Start project

Applied to files:

  • src/data/tutorial/collections-intro.mdx
🧬 Code graph analysis (5)
src/components/ApiRequestsPanel.tsx (3)
src/utils/highlight-collection-related-info.tsx (1)
  • HighlightWrapper (6-45)
src/components/ui/badge.tsx (1)
  • Badge (48-48)
src/components/ui/button.tsx (1)
  • Button (63-63)
src/collections/projects.ts (1)
src/local-api/api.projects.ts (1)
  • updatedData (28-90)
src/components/tutorial/TutorialWindow.tsx (1)
src/components/tutorial/TutorialTableOfContents.tsx (1)
  • TutorialTableOfContents (30-75)
src/components/ApiPanelToggle.tsx (4)
src/utils/highlight-collection-related-info.tsx (1)
  • HighlightWrapper (6-45)
src/components/ui/tooltip.tsx (6)
  • Tooltip (59-59)
  • TooltipTrigger (59-59)
  • TooltipContent (59-59)
  • TooltipProvider (6-17)
  • TooltipTrigger (29-33)
  • Tooltip (19-27)
src/collections/UserPreferences.ts (1)
  • userPreferencesCollection (12-19)
src/utils/USER_PLACEHOLDER_CONSTANT.ts (1)
  • USER_PLACEHOLDER (7-12)
src/components/tutorial/index.tsx (2)
src/collections/UserPreferences.ts (1)
  • userPreferencesCollection (12-19)
src/utils/USER_PLACEHOLDER_CONSTANT.ts (1)
  • USER_PLACEHOLDER (7-12)
🪛 LanguageTool
src/data/deep-dives/query-driven-sync.mdx

[style] ~54-~54: For conciseness, consider replacing this expression with an adverb.
Context: ...at are required for the queries we run. Right now, we have only one query for the `todoIt...

(AT_THE_MOMENT)

src/data/tutorial/how-do-collections-work.mdx

[style] ~14-~14: As an alternative to the over-used intensifier ‘very’, consider replacing this phrase.
Context: ...tion">ElectricSQL. Our todo app is very simple: there's only one user who can edit the...

(EN_WEAK_ADJECTIVE)


[style] ~50-~50: In American English, abbreviations like “etc.” require a period.
Context: ...ns (onUpdate, onInsert, onDelete, etc). The projectsCollection's queryFn...

(ETC_PERIOD)

⏰ 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). (1)
  • GitHub Check: Deploy Preview
🔇 Additional comments (20)
src/components/tutorial/TutorialWindow.tsx (1)

489-489: LGTM!

The navigate hook is correctly imported and used for URL cleanup when an article is loaded from search parameters.

package.json (1)

43-43: LGTM!

The dependency addition is correctly aligned with the existing @shikijs/rehype version (both at ^3.20.0) and is properly utilized in vite.config.ts for MDX code highlighting functionality.

vite.config.ts (2)

4-4: LGTM!

The import statement is correctly structured and the dependency is properly declared in package.json.


41-41: LGTM!

The transformer is correctly added to the rehype plugin configuration, enabling meta-highlight support for MDX code blocks. The function invocation syntax is proper.

.prettierignore (1)

2-2: LGTM!

The ignore pattern is consistent with the existing tutorial MDX pattern and appropriately excludes deep-dive documentation files from Prettier formatting.

src/collections/projects.ts (1)

37-38: LGTM! Improved error handling.

Re-throwing the error after logging ensures the optimistic update is immediately rolled back on failure. This is a good practice for maintaining data consistency and aligns with the same pattern applied in src/collections/todoItems.ts.

src/collections/todoItems.ts (3)

68-68: LGTM!

Minor grammatical improvement to the comment for better clarity.


83-94: LGTM! Improved error handling in onInsert.

Re-throwing the error after displaying the toast and logging ensures the optimistic insert is properly rolled back on failure. This is consistent with the error handling pattern applied throughout the collections.


137-148: LGTM! Improved error handling in onUpdate.

Two good improvements here:

  1. Renaming the catch parameter from _ to error is more descriptive
  2. Re-throwing the error ensures the optimistic update is properly rolled back on failure

This is consistent with the error handling pattern applied in both onInsert and across other collections.

src/data/deep-dives/query-driven-sync.mdx (1)

1-179: LGTM! Well-structured documentation with clear examples.

This new deep-dive article is comprehensive and well-written. It clearly explains the transition from eager to on-demand sync mode, provides practical code examples, and helpfully warns about common pitfalls.

The code examples are technically sound and the progression from problem to solution is easy to follow.

src/utils/highlight-collection-related-info.tsx (1)

36-36: LGTM! Appropriate z-index for highlighting overlay.

Adding z-50 ensures the highlighted wrapper appears above other content, which is correct for this highlighting functionality.

src/components/ApiPanelToggle.tsx (1)

4-4: LGTM! Clean integration of highlight functionality.

The HighlightWrapper integration is straightforward and maintains the existing component logic while adding tutorial highlighting capabilities.

Also applies to: 24-45

src/styles.css (1)

54-83: LGTM! Well-implemented Shiki line highlighting with proper theme support.

The CSS implementation is clean and follows modern practices:

  • Grid layout ensures proper line rendering
  • Empty line handling prevents layout collapse
  • Dark mode support is properly implemented
  • Color opacity variations provide good visual distinction
  • The use of !important is justified here to override inline Shiki styles
src/data/tutorial.ts (1)

1-1: LGTM! Clean replacement of deep-dive article.

The import and article entry have been correctly updated to reference the new "Query-driven sync" deep-dive, replacing the previous Optimistic Actions article.

Also applies to: 52-53

src/data/tutorial/what-is-next.mdx (1)

1-43: LGTM! Well-structured tutorial content.

The MDX content updates are clear and well-organized. The new imports (OpenAPIRequestsPanelLink, LinkToArticle) are used correctly throughout the file, and the restructured sections improve the tutorial flow.

src/components/ApiRequestsPanel.tsx (1)

200-253: LGTM! Clean integration of HighlightWrapper.

The HighlightWrapper integration is implemented correctly and aligns with the pattern shown in src/utils/highlight-collection-related-info.tsx. The header restructuring improves the layout while preserving all existing functionality (request count display, clear action, and request list rendering).

src/data/tutorial/collections-intro.mdx (1)

1-68: LGTM! Tutorial content improvements.

The textual updates improve clarity and accuracy. The OpenAPIRequestsPanelLink component is used correctly at Line 54, and the terminology has been properly standardized throughout (e.g., projectsCollection).

src/components/tutorial/index.tsx (1)

98-128: LGTM! Clean implementation of HighlightLink.

The HighlightLink component follows the established patterns in this file and correctly validates the highlight parameter using highlightParamSchema.

src/data/tutorial/optimistic-updates.mdx (2)

38-38: LGTM! Excellent documentation improvements.

The textual changes enhance clarity and professionalism:

  • "remote database" instead of "remote db" (line 38)
  • Proper capitalization in bullet points (lines 44-45, 47-48)
  • Removed implementation detail "toast" from user-facing text (line 48)
  • Clearer, more concise rule statement (line 51)
  • Correct semicolon usage for compound sentence (line 54)

Also applies to: 44-45, 47-48, 51-51, 54-54


6-6: OpenAPIRequestsPanelLink component is properly exported and correctly used.

The component is exported from src/components/tutorial/index.tsx at line 155 and adds helpful navigation to guide users to the API Requests panel where they can observe the sync behavior.

@fulopkovacs fulopkovacs merged commit 33ca4a2 into main Jan 4, 2026
4 checks passed
@fulopkovacs fulopkovacs deleted the update-the-guide branch January 4, 2026 20:53
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.

2 participants