Skip to content

Conversation

lucanovera
Copy link
Contributor

@lucanovera lucanovera commented Aug 5, 2025

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

  • Changed EMPTY_TYPE.enabledFeatures to undefined
  • Don't return tabs array until enabledFeatures is fully loaded
  • Move tab calculation code to a new useFeatureBasedTabs hook

Steps to Confirm

  1. Login to admin-ui using the preview link
  2. Go to integrations and click on a manual task integration
  3. Check the Details tab is active by default and it shows content

(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

  • Issue requirements met
  • All CI pipelines succeeded
  • CHANGELOG.md updated
    • Add a db-migration This indicates that a change includes a database migration label to the entry if your change includes a DB migration
    • Add a high-risk This issue suggests changes that have a high-probability of breaking existing code label to the entry if your change includes a high-risk change (i.e. potential for performance impact or unexpected regression) that should be flagged
    • Updates unreleased work already in Changelog, no new entry necessary
  • Followup issues:
    • Followup issues created
    • No followup issues
  • Database migrations:
    • Ensure that your downrev is up to date with the latest revision on main
    • Ensure that your downgrade() migration is correct and works
      • If a downgrade migration is not possible for this change, please call this out in the PR description!
    • No migrations
  • Documentation:
    • Documentation complete, PR opened in fidesdocs
    • Documentation issue created in fidesdocs
    • If there are any new client scopes created as part of the pull request, remember to update public-facing documentation that references our scope registry
    • No documentation updates required

Copy link

vercel bot commented Aug 5, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
fides-plus-nightly ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 5, 2025 2:31pm
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
fides-privacy-center ⬜️ Ignored (Inspect) Aug 5, 2025 2:31pm

Copy link
Contributor

@greptile-apps greptile-apps bot left a 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:

  1. Type Safety Enhancement: Made the enabledFeatures field optional in IntegrationTypeInfo and set it to undefined in the fallback EMPTY_TYPE constant
  2. Logic Extraction: Created a new custom hook useFeatureBasedTabs that consolidates complex tab generation logic previously scattered across components
  3. 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"
Loading

3 files reviewed, 1 comment

Edit Code Review Bot Settings | Greptile

@lucanovera
Copy link
Contributor Author

@greptileai re-review

Copy link
Contributor

@greptile-apps greptile-apps bot left a 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:

  1. Changed EMPTY_TYPE.enabledFeatures from [] to undefined
  2. Added logic to not render tabs until enabledFeatures is fully loaded
  3. 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:

  1. ✅ Manual Task integrations will show "Details" tab as active by default with content
  2. ✅ Other integrations will continue showing "Connection" tab as active by default
  3. ✅ 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.

Copy link
Contributor

@jpople jpople left a 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!

@lucanovera lucanovera merged commit 13bb64f into main Aug 5, 2025
21 checks passed
@lucanovera lucanovera deleted the ENG-1105-Integration-detail-page-tabs-not-defaulting-to-first-tab branch August 5, 2025 14:39
Copy link

cypress bot commented Aug 5, 2025

fides    Run #13205

Run Properties:  status check passed Passed #13205  •  git commit 13bb64feb1: Fix default tab not loading with Manual Task integrations (#6417)
Project fides
Branch Review main
Run status status check passed Passed #13205
Run duration 00m 53s
Commit git commit 13bb64feb1: Fix default tab not loading with Manual Task integrations (#6417)
Committer Lucano Vera
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 0
Tests that did not run due to a developer annotating a test with .skip  Pending 0
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 5
View all changes introduced in this branch ↗︎

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants