-
Notifications
You must be signed in to change notification settings - Fork 538
[ENGG-4607] Enable autoFocus for Environment Creation #3786
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
[ENGG-4607] Enable autoFocus for Environment Creation #3786
Conversation
…re instead of tabSource, add setIsNew() to useGenericState(), remove isNewRecord prop from CollectionView, trigger setIsNew(false) on collection rename
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: Nafees Nehar <[email protected]>
WalkthroughThis PR adds an isNewTab flag to the tab system and wires it through stores, hooks, tab source types, and consumer components. TabState now includes isNewTab and setIsNewTab; createTabStore gains an isNewTab parameter; GenericState/useGenericState exposes setIsNew and getIsNew now reads from store.isNewTab; tab source metadata types replace/remove the previous focusBreadcrumb property; components (CollectionView, VariablesListHeader, etc.) use getIsNew()/setIsNew(false) for autofocus and blur handling. A new public method setIsNew(...) is provided by the GenericStateContext provider. Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes
Suggested reviewers
Pre-merge checks and finishing touches❌ Failed checks (2 warnings)
✅ Passed checks (1 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🧰 Additional context used🧠 Learnings (1)📓 Common learnings🧬 Code graph analysis (1)app/src/features/apiClient/screens/environment/components/VariablesListHeader/VariablesListHeader.tsx (1)
🔇 Additional comments (2)
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. Comment |
…7-environment-autofocus-breadcrumb
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.
Pull Request Overview
This PR refactors the handling of "new tab" state from being determined by the focusBreadcrumb metadata property to a more explicit isNewTab state managed within the tab store. This change improves clarity and enables runtime updates to the "new" status.
- Renamed
focusBreadcrumbtoisNewTabin TabSourceMetadata and removed it from specific tab source interfaces - Added
isNewTabstate management to the tab store withsetIsNewTabmethod - Updated components to use
setIsNew(false)in onBlur handlers to clear the "new" state after user interaction
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| app/src/hooks/useGenericState.ts | Added setIsNew method to the GenericState interface |
| app/src/features/apiClient/screens/environment/components/environmentView/EnvironmentViewTabSource.tsx | Removed focusBreadcrumb property from interface, now using inherited isNewTab |
| app/src/features/apiClient/screens/environment/components/VariablesListHeader/VariablesListHeader.tsx | Added setIsNew(false) call in breadcrumb onBlur handler |
| app/src/features/apiClient/screens/apiClient/components/views/components/Collection/collectionViewTabSource.tsx | Removed focusBreadcrumb property from interface |
| app/src/features/apiClient/screens/apiClient/components/views/components/Collection/CollectionView.tsx | Added setIsNew(false) call in breadcrumb onBlur handler and replaced stored isNewCollection with direct getIsNew() call |
| app/src/features/apiClient/hooks/useNewApiClientContext.ts | Changed focusBreadcrumb to isNewTab |
| app/src/features/apiClient/contexts/apiClient.tsx | Changed focusBreadcrumb to isNewTab with updated boolean values |
| app/src/componentsV2/Tabs/store/tabStore.ts | Added isNewTab state property and setIsNewTab method to tab store |
| app/src/componentsV2/Tabs/store/tabServiceStore.ts | Passed source.metadata.isNewTab to createTabStore |
| app/src/componentsV2/Tabs/components/TabItem.tsx | Implemented getIsNew to read from store state and added setIsNew callback |
Comments suppressed due to low confidence (1)
app/src/features/apiClient/contexts/apiClient.tsx:207
- The value should be
falseto maintain the original behavior. The original code hadfocusBreadcrumb: false, but this was changed toisNewTab: true. Based on the context at line 78 inuseNewApiClientContext.tswhereisNewTab: !doesRecordExistis used, when a record exists (which is the case here after creating it),isNewTabshould befalse.
isNewTab: true,
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
nafees87n
left a comment
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.
Looks good
|
GitHub repository |
Closes issue:
📜 Summary of changes:
🎥 Demo Video:
Video/Demo:
✅ Checklist:
🧪 Test instructions:
🔗 Other references:
Summary by CodeRabbit