mrbrdo / spree_mobility

BSD 3-Clause "New" or "Revised" License
2 stars 1 forks source link

Issue with translations buttons click and Spree 4.4 #2

Closed Kulgar closed 2 years ago

Kulgar commented 2 years ago

It seems that I'm facing the same issue as the one you posted on spree_globalize: https://github.com/spree-contrib/spree_globalize/issues/99

mrbrdo commented 2 years ago

Fixed in main with your PR. Thanks!

mrbrdo commented 2 years ago

Actually it seems that this fix doesn't work with 4.3.1 for some weird reason. Maybe it's a timing issue with page:load. However it's probably a Spree bug, and not likely to get fixed since they moved on to 4.4, so I added a note in the Readme how to get around the issue with 4.3. https://github.com/mrbrdo/spree_mobility#spree-43x I will keep the merged PR as it's more correct anyway, and 4.3 users will have to add that line to get it working.

Kulgar commented 2 years ago

Weird... we could also do sth like the first fix I did and adding a "window.translationsActivated = true" parameter to avoid the code from being run twice. But... yeah, your workaround will work ^^

mrbrdo commented 2 years ago

Well plainly, Spree.ready implementation for spree_backend (in 4.3) is wrong. So all we can really do is workaround :) No other code is necessary because page:load doesn't get triggered at all in backend (4.3), so triggering it manually will only trigger it once per page, which is correct behavior. It's better not to complicate the solution too much just to support an older version.