-
Notifications
You must be signed in to change notification settings - Fork 2
fix: incorrect auto generated API anchor links #94
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
close IDP-1219
🦋 Changeset detectedLatest commit: cfbaf46 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
WalkthroughThis update refactors UID handling in several React components by replacing the explicit passing of Changes
Sequence Diagram(s)sequenceDiagram
participant ParentComponent
participant UidProvider
participant OpenAPIPath
participant OpenAPIRef
participant HeadingTitle
participant useUid
ParentComponent->>UidProvider: Wrap with uid value
UidProvider->>OpenAPIPath: Render as child
OpenAPIPath->>OpenAPIRef: Render without uid prop
OpenAPIRef->>useUid: Retrieve uid from context
OpenAPIRef->>UidProvider: Wrap nested content with uid
OpenAPIRef->>HeadingTitle: Render without uid prop
HeadingTitle->>useUid: Retrieve uid from context
Possibly related PRs
Poem
✨ Finishing Touches
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Signed-off-by: JounQin <admin@1stg.me>
commit: |
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.
Actionable comments posted: 0
🧹 Nitpick comments (1)
.changeset/selfish-squids-move.md (1)
5-5: Fix hyphenation in changeset description.The compound adjective should be hyphenated for proper grammar.
-fix: incorrect auto generated API anchor links +fix: incorrect auto-generated API anchor links
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
yarn.lockis excluded by!**/yarn.lock,!**/*.lock
📒 Files selected for processing (8)
.changeset/selfish-squids-move.md(1 hunks)package.json(3 hunks)src/plugins/sitemap/index.ts(1 hunks)src/runtime/components/OpenAPIPath.tsx(5 hunks)src/runtime/components/OpenAPIRef.tsx(4 hunks)src/runtime/components/_HeadingTitle.tsx(1 hunks)src/runtime/components/_RefLink.tsx(1 hunks)src/runtime/components/_context.ts(1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (3)
src/runtime/components/_HeadingTitle.tsx (1)
src/runtime/components/_context.ts (1)
useUid(5-5)
src/runtime/components/OpenAPIRef.tsx (2)
src/runtime/components/_context.ts (2)
useUid(5-5)UidProvider(7-7)src/runtime/components/_HeadingTitle.tsx (1)
HeadingTitle(15-49)
src/runtime/components/OpenAPIPath.tsx (2)
src/runtime/components/_context.ts (1)
UidProvider(7-7)src/runtime/components/_HeadingTitle.tsx (1)
HeadingTitle(15-49)
🪛 LanguageTool
.changeset/selfish-squids-move.md
[uncategorized] ~5-~5: It appears that a hyphen is missing (if ‘auto’ is not used in the context of ‘cars’).
Context: ...alauda/doom": patch --- fix: incorrect auto generated API anchor links
(AUTO_HYPHEN)
🪛 ESLint
src/runtime/components/_context.ts
[error] 1-1: Unable to resolve path to module 'react'.
(import-x/no-unresolved)
🔇 Additional comments (15)
src/plugins/sitemap/index.ts (1)
73-80: LGTM! Improved sitemap uniqueness logic.The change from using
pageData.idtopageData.routePathfor duplicate detection is logical since sitemaps should contain unique routes. This aligns with thelocfield construction which usesroutePath, and the explicitSet<string>typing improves type safety.src/runtime/components/_context.ts (1)
1-7: LGTM! Clean context implementation for UID management.The UidContext implementation follows React best practices with appropriate use of the modern
usehook. This centralized approach will eliminate prop drilling and improve consistency across components.package.json (1)
60-120: LGTM! Standard dependency maintenance updates.The dependency updates are conservative patch/minor version bumps that support the React context refactoring and tooling improvements in this PR.
src/runtime/components/_RefLink.tsx (2)
4-4: LGTM! Adopting centralized UID management.Good integration of the new
useUidhook to eliminate prop drilling.
17-19: Verify the ref processing logic change doesn't break existing links.The ref processing has been updated to remove
/components/schemas/prefix before slicing. Ensure this change maintains compatibility with existing COMMON_REFS entries and doesn't break any existing anchor links.#!/bin/bash # Description: Check COMMON_REFS usage and verify ref processing compatibility # Expected: Find COMMON_REFS definition and usage patterns to confirm compatibility # Find COMMON_REFS definition rg -A 10 "COMMON_REFS\s*=|export.*COMMON_REFS" # Find other RefLink usages to understand $ref patterns rg -A 3 -B 3 "RefLink.*\$ref|<RefLink"src/runtime/components/_HeadingTitle.tsx (3)
5-5: LGTM - Context import added correctly.The import of
useUidfrom the context module is appropriate for the refactoring.
14-14: LGTM - Comment updated to reflect context usage.The comment correctly reflects that only
sluggerneeds context simplification now, sinceuidis handled internally via theuseUidhook.
21-21: LGTM - UID now obtained from context.The component correctly uses the
useUidhook to obtain the UID from context instead of receiving it as a prop, which eliminates prop drilling and centralizes UID management.src/runtime/components/OpenAPIPath.tsx (3)
16-16: LGTM - Context provider import added.The
UidProviderimport is correctly added to support the new context-based UID management.
216-216: LGTM - UidProvider wrapper implemented correctly.The component properly wraps its entire content with
UidProvider, providing the generateduidto all descendant components through React context.Also applies to: 305-305
217-217: LGTM - UID props correctly removed from HeadingTitle components.All
HeadingTitlecomponents have had theiruidprops removed, which is consistent with the refactoring whereHeadingTitlenow obtains the UID from context using theuseUidhook.Also applies to: 224-224, 258-258, 265-265, 273-273, 285-285
src/runtime/components/OpenAPIRef.tsx (4)
12-12: LGTM - Context imports added correctly.Both
UidProvideranduseUidare imported to support the component's dual role as both a context consumer and provider.
157-163: LGTM - Robust UID resolution with fallback.The component implements a good fallback strategy: it first tries to get the UID from context using
useUid(), and if that returns a falsy value, it falls back to generating its own UID withuseId(). This ensures the component works both within and outside of existingUidProvidercontexts.
194-194: LGTM - UidProvider correctly wraps component content.The component appropriately wraps its content with
UidProvider, passing the resolved UID (either from context or generated locally) to ensure consistent UID availability for all nested components.Also applies to: 213-213
195-195: LGTM - UID prop removed from HeadingTitle.The
uidprop has been correctly removed from theHeadingTitlecomponent, which now obtains the UID from context using theuseUidhook.
close IDP-1219
Summary by CodeRabbit
Bug Fixes
Refactor
Chores