fix(web): narrow ShellMainAppDir prop type to props it actually uses#29686
Draft
jitendravjh wants to merge 1 commit into
Draft
fix(web): narrow ShellMainAppDir prop type to props it actually uses#29686jitendravjh wants to merge 1 commit into
jitendravjh wants to merge 1 commit into
Conversation
ShellMainAppDir accepted the full LayoutProps type but only ever read a subset of its fields. Fields like title, description, centered, isPublic, withoutMain, disableSticky, MobileNavigationContainer, SidebarContainer, TopNavContainer, and drawerState were declared but silently ignored, so passing them compiled fine yet had no effect. Narrowed the prop type to a Pick of exactly what the component reads. No behavior change; all 5 existing call sites (event-types, bookings, availability, and their skeletons) only pass heading/subtitle/CTA/ children, which remain supported.
Contributor
|
Welcome to Cal.diy, @jitendravjh! Thanks for opening this pull request. A few things to keep in mind:
A maintainer will review your PR soon. Thanks for contributing! |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #24433
ShellMainAppDir takes
props: LayoutProps, the full shared shell prop type, but the component body never reads most of it.title,description,centered,isPublic,withoutMain,disableSticky,MobileNavigationContainer,SidebarContainer,TopNavContainer,drawerStateare all declared on the type but nothing in the function touches them. So today if someone passestitle="foo"to it, TS is fine with it and it just silently does nothing — a footgun for whoever adds a call site later expecting it to work like it does elsewhere.Fix is just picking out the fields the component actually reads into a local
ShellMainAppDirPropstype and using that instead of the fullLayoutProps. Pure type-level narrowing, zero runtime behavior change.Went through every real usage of this component in the repo (event-types, bookings, availability + their skeletons, booking logs page) — all of them only ever pass
heading/subtitle/CTA/children, comfortably within what's still supported, so this doesn't break anything that exists today.Tested by running
tsc-absolute --pretty --noEmiton apps/web (after building tRPC types per the repo's own docs) — clean, zero errors. Also ranyarn biome checkon the file and diffed against main to confirm the warnings it flags are pre-existing nursery-rule stuff (ternaries, class sorting), not anything this PR introduced.