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

Allow forceRefresh to be toggled after instantiation. #477

Closed
gordoncl opened this issue May 18, 2017 · 2 comments
Closed

Allow forceRefresh to be toggled after instantiation. #477

gordoncl opened this issue May 18, 2017 · 2 comments

Comments

@gordoncl
Copy link

I think it would be nice if forceRefresh were configurable, even after instantiation.

The particular use case that I am envisioning is for gracefully forcing clients to update their versions. We periodically check to see if the current client is outdated and if so, it would be nice to make the next click on a link reload the application.

Another reason I think this would be nice is that <BrowserRouter>, in the react-router library, has a flag that can be toggled, but has no impact after instantiation. This makes the component uncontrolled, unfortunately. This would be an argument for making all configurations toggle-able.

I don't know what the API would look like. But, to keep it generic and re-useable across the different APIs, perhaps we want something like history.setConfig('forceRefresh', true) or history.setConfig({ forceRefresh: true }).

Thoughts?

@mjackson
Copy link
Member

forceRefresh isn't something that should change over time. Either you need to get a new page from the server when the URL changes or you don't.

Having said that, there are ways to work around this if you need them. For your use case you can just not use forceRefresh and use window.location.reload when the user clicks your link.

@getkey
Copy link

getkey commented Jul 7, 2017

It would make sense for my use case: in some pages of our website we let advertising partners inject ads. Basically we load a script from them so they have full access to our website to make changes (I know it sucks but it's how it's traditionally done).

The problem is that we don't know what they might do so I'd like to be able to refresh the page only when the user was on a modified page, to make sure the page is properly cleaned up.

@lock lock bot locked as resolved and limited conversation to collaborators Jun 4, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants