Skip to content

✅ fix: increase workflow template dropdown cap (100 limit) with debounced search#352

Open
wcatbb wants to merge 2 commits intouseplunk:nextfrom
wcatbb:next
Open

✅ fix: increase workflow template dropdown cap (100 limit) with debounced search#352
wcatbb wants to merge 2 commits intouseplunk:nextfrom
wcatbb:next

Conversation

@wcatbb
Copy link
Copy Markdown

@wcatbb wcatbb commented Apr 12, 2026

Description

The workflow builder’s “Email Template” dropdown used to fetch only the first page of templates with pageSize=100, so instances with more than 100 templates could not see or select templates beyond that limit.

This PR replaces the capped dropdown with a debounced search against the full template dataset:

  • In apps/web/src/pages/workflows/[id].tsx:
    • Remove the hard‑capped dropdown that fetched /templates?pageSize=100.
    • Add a debounced search input that queries templates on demand (20 results per request) from the entire template collection.
    • Wire the search results into both:
      • Add step dialog
      • Edit step dialog

This keeps the existing API contracts but removes the hard limit, making the selector responsive even for tenants with large template counts.

Manual test steps

  1. Go to Workflows and open an existing workflow.
  2. Add a SEND_EMAIL step and open the “Email Template” selector.
  3. Type part of a template name that would previously be beyond the first 100; after a short debounce, verify it appears in the search results (up to 20 matching results returned per query).
  4. Edit an existing SEND_EMAIL step and confirm you can search and select templates beyond the original 100‑item cap.

Type of Change

  • fix: Bug fix (PATCH version bump)
  • feat: New feature (MINOR version bump)
  • feat!: Breaking change - new feature (MAJOR version bump)
  • fix!: Breaking change - bug fix (MAJOR version bump)
  • docs: Documentation update (no version bump)
  • chore: Maintenance/dependencies (no version bump)
  • refactor: Code refactoring (no version bump)
  • test: Adding tests (no version bump)
  • perf: Performance improvement (PATCH version bump)

PR Title Format

Suggested title (conventional commits):

fix: improve workflow template selector with debounced search

Testing

Manually verified in a Plunk instance with >100 templates:

  • Add step dialog: debounced search returns templates beyond index 100.
  • Edit step dialog: debounced search also returns templates beyond index 100, and existing selections remain intact.

Checklist

  • PR title follows conventional commits format
  • Code builds successfully
  • Tests pass locally
  • Documentation updated (if needed)

Related Issues

Closes #351

@wcatbb wcatbb changed the title ✅ fix: increase workflow template dropdown cap by increasing page size ✅ fix: increase workflow template dropdown cap (100 limit) with debounced search Apr 12, 2026
@driaug
Copy link
Copy Markdown
Member

driaug commented Apr 12, 2026

This component should be in a separate file instead of being defined inline.

We also show a template picker in the campaigns pages.

@wcatbb
Copy link
Copy Markdown
Author

wcatbb commented Apr 12, 2026

Component extracted to TemplateSearchPicker. Using the campaigns' TemplateSelectionDialog here would create a nested dialog-in-dialog UX problem, and its field-selection step is irrelevant in the workflow context where we only need a template ID.

TemplateSearchPicker also fixes the pagination bug — the previous fetched all templates upfront and was silently capped at 100 by the API controller. The new component uses debounced server-side search, fetching 20 results at a time.

@driaug
Copy link
Copy Markdown
Member

driaug commented Apr 13, 2026

As mentioned in the previous comment. This component will also need to be integrated in the campaigns screen where you can create a campaign based on a template.

@wcatbb
Copy link
Copy Markdown
Author

wcatbb commented Apr 13, 2026

Just to make sure we’re aligned on scope:

This PR fixes the workflow builder bug described in #351 by introducing TemplateSearchPicker and using it in the workflow step dialog, with server-side search and correct pagination. The Campaigns TemplateSelectionDialog currently doesn’t have the same 100‑template cap, and its UX (field selection, separate dialog) is different from the workflow use case.

I completely agree that TemplateSearchPicker (or a shared picker) should also be reused in campaigns so template selection is consistent. Would you like this PR to stay scoped to fixing #351 in workflows, and we open a follow‑up issue/PR to integrate TemplateSearchPicker into campaigns?

Or do you need the campaigns integration in this same PR for it to be mergeable? Happy to follow whichever path you prefer — just want to avoid mixing two separate changesets without explicit agreement.

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.

Workflow Builder > Email Template dropdown does not load all templates (caps at 100)

2 participants