Skip to content

Conversation

@emma-sg
Copy link
Member

@emma-sg emma-sg commented Oct 13, 2025

Follows #2855

Changes

Refactors the workflows list page to:

  • Use a Task for fetching workflows
  • Use SearchParamsValues for filters/sorting/search parameters

Also fixes a bug with the archived item list page where updating filters wouldn't reset the page.

  • Updates the pagination component with a public-facing setPage method that takes some options
  • Uses this method in the archived item list & workflow list to update the page, rather than setting an internal state variable that wasn't updating the search params.

Testing

On the archived item page, test that all of the filters work as expected.
Test that pagination works as expected, and the page is reset when changing filter parameters.
Test that the browser's back and forward buttons work as expected when changing filters/search/sorting/pages.

Known Issues

  • When changing a filter when you're on a page other than the first, the page is reset to the first page in a separate step from the filter change, which means that if you use your browser's navigation buttons to go back you'll need to go back twice to get to where you were before. E.g.:

    • ?page=3 → user sets a filter → ?mine=true — this works as expected, but from here:
    • ?mine=true → user presses back button in browser → ?mine=true&page=3 → user presses back button again → ?page=3

    I'm not totally sure what the best approach here is. Ideally I think we'd hook into Lit's reactive update cycle from the search values controller and only do a single history.pushState in the update stage, but I'm not sure there's an easy way to do that without digging pretty deep into Lit's internals. Open to ideas though!

@emma-sg emma-sg changed the title Frontend persist workflow search Refactor workflows list to use Task & SearchParamsValue Oct 14, 2025
- updates pagination component to add function allowing overwriting page
url without pushing to history - updates searchParamsValue reactive
controller to auto-determine property name on host to allow for more
nuanced lifecycle updates in host when values change - cleans up and
updates workflow list page to correctly reset page to 1 when changing
filters in ui
it doesn't seem to be feasible without getting super hacky - i think
i'll need another approach.
@emma-sg emma-sg force-pushed the frontend-persist-workflow-search branch from 2d0e4d8 to 2d8f27f Compare October 14, 2025 20:58
@emma-sg emma-sg marked this pull request as ready for review October 14, 2025 20:59
@emma-sg emma-sg requested a review from SuaYoo October 14, 2025 20:59
Copy link
Member

@SuaYoo SuaYoo left a comment

Choose a reason for hiding this comment

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

This currently always calls this.paginationElement?.setPage(1) in the willUpdate callback, even if a page is specified in the URL as ?page=<number>, making it difficult to debug where and how the page is actually set and creating unnecessary aborted requests. I pushed some suggestions here for streamlining updates.

@emma-sg emma-sg requested a review from SuaYoo October 15, 2025 15:43
@SuaYoo
Copy link
Member

SuaYoo commented Oct 15, 2025

Per Discord convo, this seems like a good use case for preact signals with side effects, since signals would allow us to subscribe to slices of state rather than the entire search params object. Right now the behavior is a bit unexpected when updating state with a single searchParamsValue, since the entire params object is made available. Something to consider once lit signals is ready for production use.

@emma-sg emma-sg merged commit c0fcc20 into main Oct 15, 2025
29 checks passed
@emma-sg emma-sg deleted the frontend-persist-workflow-search branch October 15, 2025 20:25
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.

3 participants