-
Notifications
You must be signed in to change notification settings - Fork 1
feat(api): harden developer gear API and add catalog snapshot #367
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
Merged
Merged
Changes from 7 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
129978f
fix: replace server redirect in (.)edit with client-side navigation t…
vercel[bot] 66ab1bf
Potential fix for pull request finding
Flohhhhh 8411205
Potential fix for pull request finding
Flohhhhh 9cc3d01
Merge pull request #366 from Flohhhhh/vercel-agent/fix-edit-redirect-…
Flohhhhh d584eb5
feat(api): expose taxonomy labels in gear responses
Flohhhhh 85f1400
docs(api): align gear detail response examples
Flohhhhh 27bae5f
feat(api): add cached catalog snapshot endpoint
Flohhhhh c64ddb7
fix(api): avoid invalidating catalog for OG-only updates
Flohhhhh a5a38c0
fix(auth): refresh developer access in user menu
Flohhhhh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
src/app/[locale]/(pages)/gear/_components/edit-already-pending-redirect.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| "use client"; | ||
|
|
||
| import { useRouter } from "next/navigation"; | ||
| import { useEffect } from "react"; | ||
|
|
||
| /** | ||
| * Client component that handles the "already has a pending edit" case. | ||
| * | ||
| * Rendered by the (.)edit intercepting route instead of a server-side | ||
| * `redirect()`. A server redirect inside a parallel-route interception slot | ||
| * causes the Next.js router to re-fetch the slot on every prefetch / soft-nav, | ||
| * producing a runaway request loop (~100+ req/s from a single tab). | ||
| * | ||
| * This component navigates back on the client and shows a toast, which avoids | ||
| * the RSC re-fetch loop entirely. | ||
| */ | ||
| export function EditAlreadyPendingRedirect({ | ||
| slug, | ||
| pendingId, | ||
| }: { | ||
| slug: string; | ||
| pendingId: string; | ||
| }) { | ||
| const router = useRouter(); | ||
|
|
||
| useEffect(() => { | ||
| router.replace(`/gear/${slug}?editAlreadyPending=1&id=${pendingId}`, { | ||
| scroll: false, | ||
| }); | ||
| }, [router, slug, pendingId]); | ||
|
|
||
| return null; | ||
| } | ||
|
Flohhhhh marked this conversation as resolved.
|
||
38 changes: 38 additions & 0 deletions
38
src/app/[locale]/(pages)/gear/_components/edit-already-pending-toast.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| "use client"; | ||
|
|
||
| import { usePathname, useRouter, useSearchParams } from "next/navigation"; | ||
| import { useEffect } from "react"; | ||
| import { toast } from "sonner"; | ||
|
|
||
| /** | ||
| * Reads the `editAlreadyPending` search param set by the edit route redirect, | ||
| * shows a user-facing toast, and cleans up the URL. | ||
| * | ||
| * Mirrors the pattern used by `EditAppliedToast` for the `editApplied` param. | ||
| */ | ||
| export function EditAlreadyPendingToast() { | ||
| const rawPathname = usePathname(); | ||
| const router = useRouter(); | ||
| const searchParams = useSearchParams(); | ||
|
|
||
| useEffect(() => { | ||
| if (searchParams.get("editAlreadyPending") !== "1") return; | ||
|
|
||
| toast.info("You already have a pending edit for this item.", { | ||
| description: "Your previous suggestion is still under review.", | ||
| }); | ||
|
|
||
|
Flohhhhh marked this conversation as resolved.
|
||
| const nextParams = new URLSearchParams(searchParams.toString()); | ||
| nextParams.delete("editAlreadyPending"); | ||
| nextParams.delete("id"); | ||
|
|
||
| router.replace( | ||
| nextParams.size > 0 | ||
| ? `${rawPathname}?${nextParams.toString()}` | ||
| : rawPathname, | ||
| { scroll: false }, | ||
| ); | ||
| }, [rawPathname, router, searchParams]); | ||
|
|
||
| return null; | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.