-
Notifications
You must be signed in to change notification settings - Fork 85
Fix default tab not loading with Manual Task integrations #6417
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
Fix default tab not loading with Manual Task integrations #6417
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Skipped Deployment
|
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.
Greptile Summary
This PR fixes a bug where Manual Task integrations weren't displaying any tabs on their detail page. The root cause was in the tab rendering logic that returned an empty array when enabledFeatures
was falsy, preventing default tab selection.
The solution involves three key changes:
- Type Safety Enhancement: Made the
enabledFeatures
field optional inIntegrationTypeInfo
and set it toundefined
in the fallbackEMPTY_TYPE
constant - Logic Extraction: Created a new custom hook
useFeatureBasedTabs
that consolidates complex tab generation logic previously scattered across components - Proper Loading State Handling: The hook now properly handles cases where integration features haven't loaded yet by returning an empty array initially
For Manual Task integrations specifically, this ensures they show their correct tab structure (Details + Manual tasks tabs) instead of the standard Connection-based tabs used by other integration types. The refactoring also improves code maintainability by centralizing tab configuration logic.
PR Description Notes:
- The PR description is incomplete with placeholder text ("Write some things here", "list your code changes here", etc.)
- Missing specific issue reference (shows "[]" placeholder)
- Steps to confirm and code changes sections are not filled out
Important Files Changed
Click to expand
Filename | Score | Overview |
---|---|---|
clients/admin-ui/src/features/integrations/add-integration/allIntegrationTypes.tsx |
4/5 | Made enabledFeatures optional and set to undefined in fallback type |
clients/admin-ui/src/pages/integrations/[id].tsx |
2/5 | Refactored to use new hook but contains console.log and potential empty array issue |
clients/admin-ui/src/features/integrations/hooks/useFeatureBasedTabs.tsx |
4/5 | Added new hook to centralize tab generation logic with proper loading state handling |
Confidence score: 3/5
- This PR addresses a specific UI bug but has some implementation concerns that could cause issues
- Score reflects the console.log statement in production code and potential race condition with empty tab arrays
- Pay close attention to the integration detail page component for proper tab initialization
Sequence Diagram
sequenceDiagram
participant User
participant Router
participant IntegrationDetailView
participant useGetDatastoreConnectionByKeyQuery
participant getIntegrationTypeInfo
participant useFeatureBasedTabs
participant useURLHashedTabs
participant Tabs
User->>Router: "Navigate to /integrations/[id]"
Router->>IntegrationDetailView: "Load page with integration ID"
IntegrationDetailView->>useGetDatastoreConnectionByKeyQuery: "Fetch connection data by ID"
useGetDatastoreConnectionByKeyQuery->>IntegrationDetailView: "Return connection data"
IntegrationDetailView->>getIntegrationTypeInfo: "Get integration type info with connection_type and saas_config.type"
getIntegrationTypeInfo->>IntegrationDetailView: "Return enabledFeatures, overview, instructions, description"
IntegrationDetailView->>useFeatureBasedTabs: "Generate tabs based on enabledFeatures"
Note over useFeatureBasedTabs: Check if enabledFeatures exists before creating tabs
useFeatureBasedTabs->>useFeatureBasedTabs: "Create tabs array based on enabled features"
alt enabledFeatures includes WITHOUT_CONNECTION
useFeatureBasedTabs->>useFeatureBasedTabs: "Add Details tab"
else
useFeatureBasedTabs->>useFeatureBasedTabs: "Add Connection tab"
end
alt enabledFeatures includes DATA_SYNC
useFeatureBasedTabs->>useFeatureBasedTabs: "Add Data sync tab"
end
alt enabledFeatures includes DATA_DISCOVERY
useFeatureBasedTabs->>useFeatureBasedTabs: "Add Data discovery tab"
end
alt enabledFeatures includes TASKS
useFeatureBasedTabs->>useFeatureBasedTabs: "Add Manual tasks tab"
end
useFeatureBasedTabs->>IntegrationDetailView: "Return tabs array"
IntegrationDetailView->>useURLHashedTabs: "Initialize with tab keys from generated tabs"
useURLHashedTabs->>IntegrationDetailView: "Return activeTab and onTabChange handler"
IntegrationDetailView->>Tabs: "Render Tabs component with items, activeKey, and onChange"
Tabs->>User: "Display tabs with default tab selected"
3 files reviewed, 1 comment
@greptileai re-review |
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.
Looking at this PR, the fix addresses a specific issue with Manual Task integrations where the default tab wasn't loading properly. The solution is well-structured and addresses the root cause effectively.
Key Changes Analysis
Problem: The issue occurred because during loading, EMPTY_TYPE
returned an empty array for enabledFeatures
, which caused the "Connection" tab to be shown initially. After loading the real integration data, Manual Task integrations should show a "Details" tab instead, but the state was already initialized with the wrong tab.
Solution: The fix has three main parts:
- Changed
EMPTY_TYPE.enabledFeatures
from[]
toundefined
- Added logic to not render tabs until
enabledFeatures
is fully loaded - Extracted tab logic into a reusable
useFeatureBasedTabs
hook
Code Quality Assessment
The refactoring is excellent:
- Separation of concerns: Moving complex tab logic into a dedicated hook improves maintainability
- Type safety: The optional
enabledFeatures
type change is consistent across the codebase - Loading state handling: The guard clause
if (!enabledFeatures) return []
prevents premature tab rendering
Potential Considerations
The hook has quite a few parameters (12), which might indicate high coupling. However, given that this is UI-specific logic that needs access to various pieces of state, this seems reasonable for this use case.
The solution correctly maintains backward compatibility - other integration types will continue working as expected since they don't rely on the loading state behavior that was problematic for Manual Tasks.
Verification
The fix should resolve:
- ✅ Manual Task integrations will show "Details" tab as active by default with content
- ✅ Other integrations will continue showing "Connection" tab as active by default
- ✅ No tabs will render during the initial loading state, preventing the race condition
This is a solid fix that addresses the root cause while improving code organization. The approach of waiting for the real data to load before rendering tabs is the correct solution for this timing issue.
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.
Code looks good-- tested in Vercel environment, confirming working as intended. Nice fix!
fides
|
Project |
fides
|
Branch Review |
main
|
Run status |
|
Run duration | 00m 53s |
Commit |
|
Committer | Lucano Vera |
View all properties for this run ↗︎ |
Test results | |
---|---|
|
0
|
|
0
|
|
0
|
|
0
|
|
5
|
View all changes introduced in this branch ↗︎ |
Description Of Changes
Fixes an issue where if you open the integration detail page for a Manual Task integration, the first tab isn't active and the tab content area is empty.
The issue was caused because during loading the EMPTY_TYPE response was being used and the "Connection" tab is shown. After loading the real integration, the "Details" tab is returned instead, but the "Connection" tab was used already to initialized the state. The solution was to set enabledFeatures to undefined, and don't return the tabs until the real integration enabledFeatures is loaded.
Code Changes
Steps to Confirm
(regression)
4. Find any other type of integration and click on it
5. Check the Connection tab is active by default and it shows content
Pre-Merge Checklist
CHANGELOG.md
updatedmain
downgrade()
migration is correct and works