wixLocation.to(path) doesn't load dynamic pages properly

I could post the whole code, but doubt people want to decode the whole thing. Which is why I posted as little as possible to show the concept of what is suppose to happen. All sortColors() does is sort the list of colors by hues/saturation. And I know for sure that isn’t the root because another repeater that involves show/hide doesn’t work either and doesn’t use that function. You can see the left side all of the pictures gets a red line underneath when it should only be one (the one that is in the main display).

Any idea why it loads perfectly fine when loading it normally, refreshing it, etc. but won’t work when using wixLocation.to() to go from one dynamic page item to another?

And as I’ve said, the only work around seems to be using wixLocation.to(baseUrl+path) instead of just (path). In terms of load times for me, it seems to be fine, but I don’t know if it will affect SEO, data consumption, etc.