Skip to content

perf: load session table data from shared client-side endpoint#286

Merged
mirumodapon merged 5 commits into
mainfrom
session-data
Jul 18, 2026
Merged

perf: load session table data from shared client-side endpoint#286
mirumodapon merged 5 commits into
mainfrom
session-data

Conversation

@Link1515

@Link1515 Link1515 commented Jul 15, 2026

Copy link
Copy Markdown
Member

Summary

將完整議程 table 資料改為由 client 端透過共用的靜態 /api/session 載入,避免每個 /session/<id> 頁的 _payload.json 都重複包含整份 session 資料。同時保留 SSG 產生 session detail 靜態頁的能力,確保 GitHub Pages 部署後仍可直接開啟 detail URL。

Changes

  • app/pages/session.vue 的完整議程資料改為 server: false,讓 table 資料只在 client 端請求。
  • 在 SSG 階段另外透過 $fetch('/api/session') 取得 session 清單,只用來註冊 /session/<id> prerender routes。
  • app/app.vue 明確加入 /api/session prerender,確保靜態部署時 client 可請求 session JSON。

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features

    • Added a session loading skeleton to improve perceived performance while data loads.
    • Extended prerendering support to include /api/session and generate session detail routes when applicable.
  • Bug Fixes

    • Updated the session page to reliably load and gate rendering with clear loading states.
    • Added response validation/normalization so session data is structured consistently before use.

@rileychh-dokploy-coscup

rileychh-dokploy-coscup Bot commented Jul 15, 2026

Copy link
Copy Markdown

Dokploy Preview Deployment

Name Status Preview Updated (UTC)
Nuxt ✅ Done Preview URL 2026-07-17T08:41:37.408Z

@coderabbitai

coderabbitai Bot commented Jul 15, 2026

Copy link
Copy Markdown

Review Change Stack

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: 3022d880-c3fe-49b3-b728-8fbf1d9cfadc

📥 Commits

Reviewing files that changed from the base of the PR and between 30e1322 and 8482da6.

📒 Files selected for processing (1)
  • app/pages/session.vue
🚧 Files skipped from review as they are similar to previous changes (1)
  • app/pages/session.vue

📝 Walkthrough

Walkthrough

The session page now fetches and validates data client-side, prerenders session detail routes from server-fetched summaries, and displays a reusable loading skeleton. The session API is also added to application prerender targets.

Changes

Session data and loading

Layer / File(s) Summary
Session fetch and prerender flow
app/app.vue, app/pages/session.vue
The session API is added to prerender targets; client-only fetching validates session data and tracks loading status, while server-side summaries generate /session/:id routes and day synchronization waits for loaded data.
Session loading presentation
app/components/feature/CpSessionLoadingSkeleton.vue, app/pages/session.vue
A responsive pulsing skeleton is added and used for both the ClientOnly fallback and active loading state.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant SessionPage
  participant SessionAPI
  participant NuxtPrerenderer
  SessionPage->>SessionAPI: Fetch and validate sessions by day
  SessionAPI-->>SessionPage: Return typed session summaries
  SessionPage->>NuxtPrerenderer: Register session detail routes
Loading

Possibly related PRs

  • COSCUP/2026#215: Updates the session API to build and group session summaries by day, matching this page’s typed session response.
  • COSCUP/2026#228: Also changes session-day handling in app/pages/session.vue.
  • COSCUP/2026#238: Also modifies the session page’s data-driven rendering path.

Suggested reviewers: rileychh

🚥 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 accurately summarizes the main change: loading session table data from a shared client-side endpoint for performance.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch session-data

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.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 97456352d7

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread app/pages/session.vue

@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.

Actionable comments posted: 1

🤖 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.

Inline comments:
In `@app/pages/session.vue`:
- Around line 26-29: Update the useFetch call in the session page setup to
remove await and enable lazy fetching, preserving the existing /api/session
request and status-based isSessionLoading computed state so the page renders
immediately with its loading skeleton.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: ed50f4c6-93e1-4718-9910-dde1462d118a

📥 Commits

Reviewing files that changed from the base of the PR and between 3e53e34 and 9745635.

📒 Files selected for processing (3)
  • app/app.vue
  • app/components/feature/CpSessionLoadingSkeleton.vue
  • app/pages/session.vue

Comment thread app/pages/session.vue Outdated
@mirumodapon

Copy link
Copy Markdown
Collaborator

從 PREVIEW 看起來 議程表直接不見了

@Link1515

Link1515 commented Jul 15, 2026

Copy link
Copy Markdown
Member Author

從 PREVIEW 看起來 議程表直接不見了

已修正
問題出在 SSG 後,取靜態 /api/session 直接拿到 JSON 字串,不會自動轉換成 JS 物件,進而導致後續資料處理錯誤
加入 transform 配置進行轉換後就可以正確顯示 (30e1322)

preview: https://preview-coscup-2026-nuxt-hubug4-nsrryb.rileychh.dev/2026/session

pan93412
pan93412 previously approved these changes Jul 16, 2026
Comment thread app/components/feature/CpSessionLoadingSkeleton.vue
@mirumodapon

Copy link
Copy Markdown
Collaborator

看起來小了不少 👍

before:
截圖 2026-07-16 22 52 19

after:
截圖 2026-07-16 22 52 32

mirumodapon
mirumodapon previously approved these changes Jul 16, 2026

@mirumodapon mirumodapon left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

@mirumodapon

Copy link
Copy Markdown
Collaborator

我在自己環境 build 會沒有議程誒 OAO

@Link1515

Copy link
Copy Markdown
Member Author

我在自己環境 build 會沒有議程誒 OAO

請問有出現錯誤訊息嗎?
如果是在本地 build,可以說明一下你的步驟讓我重現看看嗎?

@mirudapon

Copy link
Copy Markdown

我在自己環境 build 會沒有議程誒 OAO

請問有出現錯誤訊息嗎? 如果是在本地 build,可以說明一下你的步驟讓我重現看看嗎?

大概就是...

$ rm -rf .data .nuxt .output dist
$ pnpm build
$ mv dist 2026
$ pnpx http-server .

這樣議程表打開會說尚未公布

btw..

$ pnpm dev

看起來是正常的

@Link1515
Link1515 dismissed stale reviews from mirumodapon and pan93412 via 8482da6 July 17, 2026 08:38
@Link1515

Link1515 commented Jul 17, 2026

Copy link
Copy Markdown
Member Author

我在自己環境 build 會沒有議程誒 OAO

請問有出現錯誤訊息嗎? 如果是在本地 build,可以說明一下你的步驟讓我重現看看嗎?

大概就是...

$ rm -rf .data .nuxt .output dist
$ pnpm build
$ mv dist 2026
$ pnpx http-server .

這樣議程表打開會說尚未公布

btw..

$ pnpm dev

看起來是正常的

http-server 對無副檔名的路徑(/api/session)會回傳 Content-Type: application/octet-stream,因此 ofetch 會將回應解析為 Blob

但在 Preview 環境中,相同內容會以 Content-Type: text/plain 回傳,ofetch 因而直接解析為字串

為了相容兩種情境,額外加入 Blob 的處理邏輯 (8482da6)

@mirumodapon

Copy link
Copy Markdown
Collaborator

我在自己環境 build 會沒有議程誒 OAO

請問有出現錯誤訊息嗎? 如果是在本地 build,可以說明一下你的步驟讓我重現看看嗎?

大概就是...

$ rm -rf .data .nuxt .output dist
$ pnpm build
$ mv dist 2026
$ pnpx http-server .

這樣議程表打開會說尚未公布
btw..

$ pnpm dev

看起來是正常的

http-server 對無副檔名的路徑(/api/session)會回傳 Content-Type: application/octet-stream,因此 ofetch 會將回應解析為 Blob

但在 Preview 環境中,相同內容會以 Content-Type: text/plain 回傳,ofetch 因而直接解析為字串

為了相容兩種情境,額外加入 Blob 的處理邏輯 (8482da6)

WOW!! 先受小弟一拜

@mirumodapon
mirumodapon merged commit d7a21bc into main Jul 18, 2026
2 checks passed
@mirumodapon
mirumodapon deleted the session-data branch July 18, 2026 08:44
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.

4 participants