-
Notifications
You must be signed in to change notification settings - Fork 1
Highlight current section in sidebar table of contents #79
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
Conversation
…n sidebar Co-authored-by: na-trium-144 <[email protected]>
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
my-code | 4850b07 | Commit Preview URL Branch Preview URL |
Oct 27 2025, 01:44 AM |
|
@copilot sidebarはapp/layout.tsxから呼び出されるので、[docs_id]/page.tsxにProviderを置いても使えません。外側のlayout.tsxにProviderをおく必要があります。 |
Co-authored-by: na-trium-144 <[email protected]>
Fixed in b1af976. Moved DynamicMdProvider to layout.tsx with empty initial array. pageContent.tsx now manages both local state (for SSR) and updates the context separately as you suggested. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
app/sidebar.tsx
Outdated
| // コンテキストが空の場合(まだページがロードされていない場合)はフェッチする | ||
| const { data, error, isLoading } = useSWR( | ||
| dynamicMdContent.length === 0 ? `/docs/${docs_id}.md` : null, | ||
| fetcher | ||
| ); |
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.
@copilot ページがロードされる時間とこれをfetchする時間はほぼ変わらないので、このfetchは要らないです
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.
Fixed in f090192. Removed the SWR fetch - sidebar now only uses context data.
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.
@copilot ページを切り替えた際に前のページのdynamicMdContentが残ってしまっています。
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.
Fixed in f090192. Added cleanup effect that clears context when PageContent unmounts.
Co-authored-by: na-trium-144 <[email protected]>
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
@copilot dynamicMdContent→sidebarMdContent、localDynamicMdContent→dynamicMdContentに名前変更して |
…ntent→dynamicMdContent Co-authored-by: na-trium-144 <[email protected]>
Fixed in 4850b07. Renamed all variables and context:
Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
Plan: Highlight Current Section in Sidebar
dynamicMdContentfrom pageContent.tsx to sidebar.tsxdynamicMdContentinView: true) boldsidebarMdContent, page usesdynamicMdContentSummary
This PR implements highlighting of the current section in the sidebar table of contents as requested in the issue.
Implementation Details
1. Created
dynamicMdContext.tsxA new React context that shares
DynamicMarkdownSection[]data between components:sidebarMdContentstate and its setter for sharing with sidebar2. Updated
layout.tsxSidebarMdProviderso Sidebar has access3. Updated
pageContent.tsxdynamicMdContentfor SSR and page rendering) and context state (sidebarMdContentfor sidebar)4. Updated
page.tsx5. Updated
sidebar.tsxsidebarMdContent.length > 0(page is loaded)inView: trueas the current sectionfont-boldclass to highlight the current section in the table of contentsNaming
sidebarMdContent: Content shared via context for sidebar displaydynamicMdContent: Local state in pageContent for page rendering and SSRTesting
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.