Making filters work without reload

I’ve just done some work on discourse-solved, and added some filters. These work fine if you visit the URLs directly, but if you follow a link from within the site then it doesn’t work.

If I click on this link, it doesn’t apply the filter until I hit reload.

support - Discourse Meta

Do I need to add it to the Ember router or something like that? How would I go about doing that?

1 Like

AddDiscoveryQueryParam is your friend

https://github.com/discourse/discourse-assign/blob/master/assets/javascripts/discourse/initializers/extend-for-assigns.js.es6#L59

2 Likes

Well, that was easy - it’s almost like someone’s had this problem before :wink:

Thanks again, I’ve submitted another PR

3 Likes

Just in case someone comes across this thread in future, using “true”/“false” in the query variables can create some unexpected behaviour. Ember will consider “false” the default, which might not be what you want.

4 Likes

Is this working ?

I’ve noticed when i select the filter solved it doesnt filter the topics unless i reload the page.