Skip to content

Conversation

puretension
Copy link

Fixes #14807

Motivation

WorkflowTemplates UI silently ignores label query parameters (e.g., ?label=key%3Dvalue) unlike Workflows list, breaking URL filtering and preventing custom UI links for filtered template views.

Modifications

  • Added label query parameter sync with URL in WorkflowTemplates UI
  • Combined URL updates and localStorage persistence in single useEffect
  • Now matches Workflows list behavior for consistent filtering
ref-recorded-video.mov

Verification

  • ?label=key%3Dvalue now properly filters WorkflowTemplates
  • URL updates when changing filters in UI
  • Filters persist on page refresh

Documentation

Copy link
Member

@eduardodbr eduardodbr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tested locally with success

@puretension
Copy link
Author

puretension commented Sep 7, 2025

Hi @eduardodbr,

Thanks for approving! After implementing this fix,
I noticed we have duplicate label synchronization logic across multiple components:

Duplicate patterns found:

workflows-list.tsx + workflow-template-list.tsx: Same useState + queryParams + localStorage logic
cron-workflows/cron-workflow-list.tsx: Has labels state but missing URL sync
reports/reports.tsx: Different queryParams pattern

Duplicated code pattern:

typescript
// Repeated in multiple files
const [labels, setLabels] = useState(() => {
    const queryParams = new URLSearchParams(location.search);
    const labelQueryParam = queryParams.getAll('label');
    return labelQueryParam.length > 0 ? labelQueryParam : savedLabels;
});

Proposal:

Would you be interested in a follow-up PR after this merges that extracts this
into a shared custom hook? This would:

• Eliminate code duplication
• Improve maintainability
• Standardize label filtering across all components

Let me know what you think!

@eiriklid
Copy link

Hey, I would really like to have this feature.

Is there any way I can contribute so that it can be released?

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.

WorkflowTemplates page does not support label filtering via query parameters in the UI

3 participants