Making filters work without reload


(David Taylor) #1

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?


(Sam Saffron) #2

AddDiscoveryQueryParam is your friend

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


(David Taylor) #3

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

Thanks again, I’ve submitted another PR


(David Taylor) #4

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.