Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Co-authored-by: surajair <9153560+surajair@users.noreply.github.com>
Deploying sdk with
|
| Latest commit: |
d732833
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://a4cbff22.sdk-8n4.pages.dev |
| Branch Preview URL: | https://copilot-fix-152845344-752521.sdk-8n4.pages.dev |
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ❌ Deployment failed View logs |
sdk-nextjs | d732833 | Mar 10 2026, 05:13 AM |
Co-authored-by: surajair <9153560+surajair@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR hides the "Page Type" dropdown in the Pages Manager when only the built-in page types ("page" and "global") are registered. It simplifies the UI by conditionally rendering the selector and ensures stale filter state is normalized back to "all" when custom types are absent.
Changes:
- Computed
hasCustomPageTypesviauseMemo, early-returningnullfromPageTypeSelectorwhen no custom types exist - Added a
useEffectguardrail to resetselectedPageTypeto"all"if it holds a stale custom-type value when custom types disappear - Replaced
anytype annotations withChaiPageTypein thePageTypeSelectorfilter functions
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
src/pages/client/components/page-manager/page-manager-search-and-filter.tsx |
Adds hasCustomPageTypes memo, normalization effect, conditional null return, and improves type annotations |
src/pages/client/components/page-manager/page-manager-search-and-filter.test.tsx |
New tests covering dropdown visibility for default-only and custom page type scenarios |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| it("hides page type dropdown when only default page types exist", () => { | ||
| mockUsePageTypes.mockReturnValue({ | ||
| data: [ | ||
| { key: "page", name: "Page", hasSlug: true }, | ||
| { key: "global", name: "Global", hasSlug: false }, | ||
| ], | ||
| }); | ||
|
|
||
| renderPageManagerSearchAndFilter(); | ||
|
|
||
| expect(screen.queryByText("All")).toBeNull(); | ||
| }); |
There was a problem hiding this comment.
The normalization useEffect (lines 52–56) resets selectedPageType to "all" when hasCustomPageTypes is false and selectedPageType !== "all". However, neither test exercises this code path — both tests pass selectedPageType="all" to the rendered component, so the effect condition is never satisfied. There is no test verifying that setSelectedPageType gets called with "all" when a non-default filter value (e.g., "landing") is held in state while custom page types are removed.
…-4e73-9e53-db8ab73fd0b4
Pages Manager currently shows a “Page Type” filter even when only built-in types are available. This updates rendering logic to show the filter only when at least one custom page type is registered, while always treating
pageandglobalas defaults.Pages Manager filter visibility
PageTypeSelectorto compute whether any custom page type exists (keynot in["page", "global"]).Filter state guardrail
selectedPageTypeto"all"when custom types are absent, preventing stale non-default filter state.Focused coverage for visibility behavior
page+globalexistOriginal prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.