Skip to content

prerender#3

Merged
Vilos92 merged 4 commits into
mainfrom
prerender
May 18, 2026
Merged

prerender#3
Vilos92 merged 4 commits into
mainfrom
prerender

Conversation

@Vilos92

@Vilos92 Vilos92 commented May 18, 2026

Copy link
Copy Markdown
Owner
  • prerender
  • ✂️ simplify config

Summary by CodeRabbit

  • New Features

    • Added pre-rendering support and server-rendered output to improve initial load and SEO.
    • Improved client hydration for more reliable startup and faster perceived rendering.
  • Chores

    • Updated build configuration and dependencies to support pre-rendering.
    • Streamlined module/path resolution in the build setup.

Review Change Stack

@coderabbitai

coderabbitai Bot commented May 18, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 24744b61-fa3a-4fdb-9479-7dd03aa108c6

📥 Commits

Reviewing files that changed from the base of the PR and between f05eacb and 5ca510c.

📒 Files selected for processing (1)
  • src/hub-app.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/hub-app.tsx

📝 Walkthrough

Walkthrough

Adds server-side prerendering: app entry exports prerender(), client-side code hydrates only in the browser, bootstrap script gets prerender attribute, preact-render-to-string added, and Vite moves tsconfig path resolution from a plugin to native config.

Changes

Server-Side Prerendering and Hydration

Layer / File(s) Summary
App prerendering and hydration
src/hub-app.tsx, index.html, package.json
Entrypoint switches from unconditional client render() to conditional hydrate() when document is present; exports prerender() using preact-render-to-string; bootstrap <script> gains prerender attribute; preact-render-to-string added to dependencies.
Vite configuration and tsconfig path resolution
vite.config.ts, package.json
Removed vite-tsconfig-paths import/plugin and enabled resolve.tsconfigPaths: true in Vite config; vite-tsconfig-paths removed from devDependencies and plugin list simplified.

Possibly Related PRs

  • Vilos92/vilos92.com#2: Modifies the Preact hub entrypoint and bootstrap mounting; related to app mounting/prerender changes.
  • Vilos92/vilos92.com#1: Changes Vite tsconfig path handling; directly related to the Vite config edits here.

Estimated Code Review Effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 I render strings by moonlit code,
Then wake the client on the road,
A tiny script with prerender sign,
Vite paths aligned, the build feels fine,
Hop, hydrate — the page is glowed.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'prerender' accurately reflects the main change across multiple files: adding prerender functionality via the new prerender() function, prerender attribute in HTML, and prerender configuration in Vite.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch prerender

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint skipped: no ESLint configuration detected in root package.json. To enable, add eslint to devDependencies.


Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
src/hub-app.tsx (1)

8-23: ⚡ Quick win

Align exported prerender entry with section/JSDoc conventions.

Please move the exported prerender entry into an API. section before Script., and add JSDoc to the export.

♻️ Proposed guideline-aligned layout
-/*
- * Script.
- */
-
-if (typeof document !== 'undefined') {
-  const root = document.getElementById('root');
-  if (!root) {
-    throw new Error('hub markup missing `#root`');
-  }
-
-  hydrate(<HubApp />, root);
-}
-
-export async function prerender() {
+/*
+ * API.
+ */
+
+/** Prerenders `HubApp` to HTML for the prerender pipeline. */
+export async function prerender() {
   return {html: renderToString(<HubApp />)};
 }
+
+/*
+ * Script.
+ */
+
+if (typeof document !== 'undefined') {
+  const root = document.getElementById('root');
+  if (!root) {
+    throw new Error('hub markup missing `#root`');
+  }
+
+  hydrate(<HubApp />, root);
+}

As per coding guidelines, "Organize files with section comments in order: ... entry surface (API., Script., ...)" and "Use JSDoc on exports and non-trivial helpers with backtick code identifiers".

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/hub-app.tsx` around lines 8 - 23, Move the exported `prerender` entry
above the `Script.` section into a new `API.` section and add a JSDoc comment on
the exported function using backtick identifiers (e.g., `prerender`, `HubApp`)
describing what it returns; keep the implementation calling
`renderToString(<HubApp />)` unchanged. Ensure the file now has an `API.`
comment block preceding the `Script.` block and the `prerender` export includes
a short JSDoc (one-liner and `@returns` with HTML string type) so it follows the
section/JSDoc conventions.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@src/hub-app.tsx`:
- Around line 8-23: Move the exported `prerender` entry above the `Script.`
section into a new `API.` section and add a JSDoc comment on the exported
function using backtick identifiers (e.g., `prerender`, `HubApp`) describing
what it returns; keep the implementation calling `renderToString(<HubApp />)`
unchanged. Ensure the file now has an `API.` comment block preceding the
`Script.` block and the `prerender` export includes a short JSDoc (one-liner and
`@returns` with HTML string type) so it follows the section/JSDoc conventions.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: aab75f9c-329d-48a1-a057-76a7c135be68

📥 Commits

Reviewing files that changed from the base of the PR and between 95af119 and f05eacb.

⛔ Files ignored due to path filters (1)
  • bun.lock is excluded by !**/*.lock
📒 Files selected for processing (4)
  • index.html
  • package.json
  • src/hub-app.tsx
  • vite.config.ts

@Vilos92 Vilos92 merged commit 58896cd into main May 18, 2026
11 checks passed
@coderabbitai coderabbitai Bot mentioned this pull request May 18, 2026
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