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

feat: exclude routes #17

Closed
ShahriarKh opened this issue Feb 14, 2024 · 5 comments
Closed

feat: exclude routes #17

ShahriarKh opened this issue Feb 14, 2024 · 5 comments
Assignees

Comments

@ShahriarKh
Copy link

It would be awesome if we had the option to exclude specific routes. For example, I do use url query params as the state of my search page: site.com/search?term=something and the progress bar is animated many times as the user types. The behavior is correct, because the url is changing (the value of term = the value of search input where the user types), and I tried to fix it a bit by debouncing. However, I'd like to exclude this route from holy loader. (Other use cases are page filters and anything that uses "url-based" state management)

In some cases, having the delay option (#2) might be better, but being able to completely exclude some routes or some params will make the library more awesome.

@tomcru tomcru self-assigned this Feb 14, 2024
@tomcru
Copy link
Owner

tomcru commented Feb 14, 2024

That's a good catch and it makes sense that it shouldn't trigger on URL states like these. I have some ideas in mind I'll try out! ✌️

@tomcru
Copy link
Owner

tomcru commented Feb 26, 2024

I've had a look at this behaviour and it is not trivial to prevent this - because it is correct behaviour (as you noted). The only thing I can think of at the moment is passing an ignorePaths prop to HolyLoader with an array of paths to exclude.

It could look something like this (accepting regex):

<HolyLoader ignorePaths={[/^\/browse\?query=.*/, /\?terms/]} />

Which would then prevent triggering HolyLoader if the new URL matches any of the patterns in ignorePaths.

@iwasrobbed
Copy link

+1 to an ignore paths option since it gives a lot of flexibility

@wottpal
Copy link

wottpal commented Aug 29, 2024

For us, an ignoreSearchParams options would be sufficient (… and quite important too, if we want to stick with HolyLoader. current UX is quite weird).

@tomcru
Copy link
Owner

tomcru commented Sep 14, 2024

I've added an ignoreSearchParams prop in the latest 2.3.4 release ✌️

https://github.com/tomcru/holy-loader/releases/tag/2.3.4

Tested this as thoroughly as I could, let me know if it's what you expected or if you run into any issues.

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

No branches or pull requests

4 participants