Skip to content

Conversation

@maxtechera
Copy link
Collaborator

Summary

Problem: The Marketplace page had all infrastructure for Organization Templates (API hook, state, data processing) but the tab and panel were never rendered. Existing code referenced activeTabValue === 3 for org templates, but Tabs only had 2 tabs (values 0 and 1).

Changes Made

  1. Added Organization Templates tab (line 754):

    • <PermissionTab permissionId='templates:custom' value={2} label='Organization Templates' />
  2. Added TabPanel for Organization Templates (lines 1058-1188):

    • Full rendering with card view and list view support
    • Usecase filtering with checkboxes
    • Empty state handling
    • Uses getOrganizationTemplatesApi.data, orgTemplateImages, orgTemplateIcons
  3. Fixed tab index references throughout component:

    • handleTabChange: Fetch custom templates on tab 1, org templates on tab 2
    • clearAllUsecases: Tab 0=community, Tab 1=custom, Tab 2=org
    • handleBadgeFilterChange, handleTypeFilterChange, handleFrameworkFilterChange, onSearchChange: Updated data selection logic
    • filterByUsecases: Updated to use correct tab indices
    • getEligibleUsecases: Updated to set correct usecase states
  4. Removed unused code:

    • Removed filterExcludeAnswerAgent function

Test Plan

  • Navigate to Marketplace page
  • Verify 3 tabs: Community Templates, My Templates, Organization Templates
  • Click Organization Templates tab
  • Verify templates display correctly
  • Test filtering and search within org templates

Fixes AGENT-594

- Add Organization Templates tab (value=2) to Marketplace page
- Add TabPanel for rendering organization templates with card/list view
- Update handleTabChange to fetch org templates on tab selection
- Fix tab index references: Community=0, My Templates=1, Org Templates=2
- Update all filter functions to use correct tab indices
- Remove unused filterExcludeAnswerAgent function
@linear
Copy link

linear bot commented Jan 9, 2026

@vercel
Copy link

vercel bot commented Jan 9, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
answerai-docs Building Building Preview Jan 9, 2026 5:49pm
the-answerai Building Building Preview Jan 9, 2026 5:49pm

@claude
Copy link

claude bot commented Jan 9, 2026

Pull Request Review: fix(AGENT-594) - Restore Organization Templates Tab

Summary

This PR successfully restores the Organization Templates tab that was previously configured but never rendered. The fix corrects tab index references throughout the component.


Strengths

  1. Problem Well-Identified: The issue was clear - infrastructure existed but tab/panel were never rendered
  2. Comprehensive Fix: All tab index references updated consistently
  3. Code Cleanup: Removed unused filterExcludeAnswerAgent function
  4. Consistent Pattern: The new Organization Templates TabPanel follows the exact same structure as My Templates tab

Issues Found

CRITICAL: Missing Data Processing on Component Mount

The Organization Templates data is only fetched when the user clicks the tab. However, there appears to be no useEffect to process the data once fetched (similar to the custom templates processing around lines 442-466).

Impact: When org template data loads, it won't be processed into images, icons, and usecases arrays. The tab will likely show empty or broken content.

Required Fix: Add a useEffect hook that processes getOrganizationTemplatesApi.data similar to how getAllCustomTemplatesApi.data is processed.


MEDIUM: Repetitive Tab Index Logic

The tab data selection pattern repeats 4 times throughout the component. Consider extracting to a helper function for maintainability.


Testing Recommendations

Beyond the manual test plan, also test:

  1. Direct Navigation: Load page with activeTab=2 set, verify data loads
  2. Permission Test: Test with user lacking templates:custom permission
  3. Filter Interaction: Apply filters on one tab, switch tabs, verify filters don't bleed
  4. Empty State: Test with organization that has no templates

Security Review

✅ Permission Control: Correctly uses PermissionTab and Available with templates:custom
✅ Data Isolation: Each tab maintains separate state
✅ No New API Endpoints: Uses existing getOrganizationTemplatesApi hook


Recommendations

Must Fix (Blocking):

  1. Add useEffect to process org template data on mount (parse flowData, extract images/icons/usecases)

Should Fix (Non-blocking):

  1. Extract repeated tab data selection logic to helper function
  2. Add E2E test case for organization templates tab

Nice to Have:

  1. Convert component to TypeScript given complexity
  2. Add comments explaining tab index mapping

Approval Status

Conditional Approval pending fix for the missing data processing useEffect. Once addressed, this is ready to merge.

The fix is straightforward and low-risk - it restores functionality that was always intended but never wired up correctly.


Reviewed by Claude Code

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