I’m slightly foxed, but wonder if I’m using this in an unsafe context.
This code is meant to return and populate a property with a list of tagged topics, but it’s returning a much bigger, unfiltered list (ignoring the filter which is the path to a specific tag)
NB This does start to work within an intra-app transition but doesn’t work as expected on reload of the page.
NB #2 I’m fairly sure this is a regression and it’s only started to act oddly recently
The Discourse Homepage Feature Component works fine under the same user actions, so I suspect it’s something to do with an uncertain state of the store during the router stage?
I’ll probably move my code out of the route and into a Component.
If that works it will get rid of a lot of unnecessarily complex route overriding in any case.
The first “topicList” to be fetched after an initial page load will automatically use the value which was “preloaded” by the server. So, if your theme is calling store.findFiltered before core does, things could get weird.
There were some changes here recently to fix some bugs where the preloaded value wasn’t being used properly, so that might explain the recent regression.
So, workaround is to make your findFiltered call happen after core’s. But… clearly this kind of racing is not by design - we could probably do with some refactoring in core to make this cleaner
Trying to help in an area where I have perhaps never been helpful before… Would clearing the preload store do the trick? That solved a similar (in my naive view) issue for me recently.