Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce fetch requests #81

Merged
merged 13 commits into from
Dec 6, 2022
Merged

Reduce fetch requests #81

merged 13 commits into from
Dec 6, 2022

Conversation

existentialmutt
Copy link
Contributor

The main purpose of this PR is to remove an unnecessary fetch request every time the user updates the filter form. This second request had been for maintaining a stableID in client state, which was needed for the stored filter workflow.

I've refactored the stored filter workflow so that it uses the current blueprint instead of stableID. This allows us to eliminate the second fetch request when the filter form is updated.

Copy link

@coderberry coderberry left a comment

Choose a reason for hiding this comment

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

Great work! Super clean!

config/routes.rb Show resolved Hide resolved
Copy link
Contributor

@leenyburger leenyburger left a comment

Choose a reason for hiding this comment

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

@existentialmutt
I had to merge in main to be able to see the filter in the test repo because of the new CSS updates. I pushed up a branch to test in that repo here: https://github.com/leenyburger/bullet_train_test_refine_npm_package/tree/reduce-fetch-requests (it's pointing to my local gemfile right now).

I'm seeing two issues:

  1. The Apply button isn't doing anything. Curiously, they're seeing this same behavior on CF2 for only 1 filter. This was Daniel's response to the thread I tagged you in over there:

Daniel Pence
1 hour ago
Very helpful, actually, thanks! I see the issue. In the cases where we want to use filters inside a modal or, in this case inside a tab panel, we need to use the turbo version of the search-filter-controller called turbo-search-filter-controller. A small tweak to that controller and changing the action on the Apply button seems to make things work as expected. Will play with it more in the morning, but I think we're unblocked at this point 👌. Thanks again 👍

  1. When the user clicks Load a Filter the filter isn't loaded into the view.

Video if the above isn't clear:
https://www.loom.com/share/c2267d528c5b4414b59e4aa8bba2dc6d

scripts/local_development_setup.md Outdated Show resolved Hide resolved
@leenyburger leenyburger merged commit 96185d9 into main Dec 6, 2022
@leenyburger leenyburger deleted the reduce-fetch-requests branch December 6, 2022 22:55
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