-
-
Notifications
You must be signed in to change notification settings - Fork 608
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
Project setup improvements #1579
base: main
Are you sure you want to change the base?
Conversation
|
Warning There were issues while running some tools. Please review the errors and either fix the tool’s configuration or disable the tool if it’s a critical failure. 🔧 eslint
apps/webapp/app/components/SetupCommands.tsxOops! Something went wrong! :( ESLint: 8.45.0 ESLint couldn't find the config "custom" to extend from. Please check that the name of the config is correct. The config "custom" was referenced from the config file in "/.eslintrc.js". If you still have problems, please stop by https://eslint.org/chat/help to chat with the team. WalkthroughThis pull request introduces a new Changes
Sequence DiagramsequenceDiagram
participant App as Application
participant PMProvider as PackageManagerProvider
participant Component as Child Components
App->>PMProvider: Wrap components
PMProvider-->>Component: Provide package manager context
Component->>PMProvider: Access/modify active package manager
PMProvider-->>Component: Return current package manager state
Possibly related PRs
Suggested reviewers
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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 (
|
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 (3)
apps/webapp/app/components/SetupCommands.tsx (2)
21-29
: Optional improvement: allow overriding the default package manager.
You could accept an initial package manager value from props if future requirements need flexible defaults.export function PackageManagerProvider({ children, + defaultManager = "npm", }: { children: React.ReactNode; + defaultManager?: string; }) { - const [activePackageManager, setActivePackageManager] = useState("npm"); + const [activePackageManager, setActivePackageManager] = useState(defaultManager); return ( <PackageManagerContext.Provider value={{ activePackageManager, setActivePackageManager }}> {children} </PackageManagerContext.Provider> ); }
196-200
: Check usage of both 'defaultValue' and 'value' props.
When providing the controlled “value” prop, “defaultValue” is typically unnecessary. You might remove “defaultValue” if you prefer a fully-controlled component.<ClientTabs - defaultValue="npm" value={activePackageManager} onValueChange={setActivePackageManager} >
apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.v3.$projectParam._index/route.tsx (1)
439-452
: Wrapping instructions in PackageManagerProvider for context.
This pattern is consistent with the rest of the setup instructions, ensuring consistent package manager selection.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
apps/webapp/app/components/SetupCommands.tsx
(5 hunks)apps/webapp/app/components/primitives/ClientTabs.tsx
(1 hunks)apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.v3.$projectParam._index/route.tsx
(3 hunks)
🔇 Additional comments (14)
apps/webapp/app/components/SetupCommands.tsx (9)
1-2
: Imports look consistent and necessary.
These imported hooks and functions appear to align well with the new context usage.
14-17
: Context type definition is clear.
The type provides clarity on what values are expected. Consider using a union type if you anticipate multiple fixed package manager options (e.g., "npm" | "pnpm" | "yarn").
19-19
: Context creation is straightforward.
This approach ensures that any consumer can safely handle undefined contexts via the hook.
31-37
: Hook usage is nicely implemented.
Throwing an error for undefined context guards against improper usage.
193-194
: Context destructuring is accurate.
Accessing the active package manager and setter is straightforward and consistent with the new context interface.
235-236
: Same destructuring pattern as above.
This usage is consistent with the established pattern in InitCommandV3.
238-242
: Duplicated tab control pattern.
As previously mentioned, verify if you still need “defaultValue” when the component is controlled by “value”.
277-278
: Consistent destructuring for the active package manager.
All lines match the pattern of retrieving context values.
280-284
: Duplicated controlled usage of ClientTabs.
Consider removing “defaultValue” to avoid confusion, as the “value” prop is already controlling the tabs.
apps/webapp/app/components/primitives/ClientTabs.tsx (1)
8-12
: Ref forwarding approach looks solid.
This enables parent components to attach refs directly to the underlying TabsPrimitive.Root, improving flexibility and interoperability.
apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.v3.$projectParam._index/route.tsx (4)
23-28
: New imports for the context-based components appear appropriate.
These imports integrate seamlessly with the project’s existing architecture.
454-470
: Introductory steps are clear and user-friendly.
They effectively guide new users through preexisting commands.
472-472
: Closing tag for the provider is logically placed.
No issues detected here.
494-515
: UserHasNoTasks instructions wrapped in the context.
This consolidates the environment setup instructions, ensuring consistent usage of active package manager state.
@trigger.dev/react-hooks
@trigger.dev/rsc
@trigger.dev/sdk
@trigger.dev/build
trigger.dev
@trigger.dev/core
commit: |
Reworded step 1 to make it clear you setup in an existing project
When you toggle the package manager options, they stay in sync
CleanShot.2024-12-19.at.13.14.41.mp4
Summary by CodeRabbit
New Features
PackageManagerProvider
for dynamic management of the active package manager across multiple components.ClientTabs
to support ref forwarding, enhancing interoperability with other components.Improvements
PackageManagerProvider
, improving context for setup instructions.Bug Fixes