sindreslungaard / duel-masters

Browser based Duel Masters simulator.
MIT License
62 stars 41 forks source link

Update to vue3 #233

Closed DanieloV closed 1 week ago

DanieloV commented 1 month ago

Related to https://github.com/sindreslungaard/duel-masters/pull/229 - Reopens it as it was reverted

Also adds tailwindcss through the package manager.

This fixes the websockets not closing issues.

sindreslungaard commented 1 month ago

Ref #229 the two issues I noticed was

  1. For each ongoing duel the lobby would display it twice. One "Waiting to start..." and one for the actual duel that you could spectate. This is because the lobby shows both active "duel requests" and active "matches" and the "requests" are only removed once the host socket leaves (usually when the match starts as you are routed away from the lobby). In hindsight the request should be removed automatically when the match starts anyways but can add that later as it turned into a nice way of debuggingif the sockets were closed properly or not alt
  2. When you spectate a duel and then navigate back and forth using the browser navigation you would get an error saying you've started spectating from a new browser/tab. Again likely because the previous connection didn't close when you navigated out of the duel. I think similarly if you navigatet to the "decks" page from the lobby and back you would have 2 open connections in the lobby.

I see this PR also updates the beforeDestroyed to use unmounted which I believe I tried yesterday but didn't fix all the cases where a connection would stay open, and if I remember correctly the lobby connection is only created in the created lifecycle hook, so it might not recreate it if closed in unmounted, not sure.

Seems like maybe the vue 3 router history mode is different from the vue 2 router history mode in that it doesn't destroy and create the views when you navigate between pages and instead only unmounts and mounts it.

Btw. what's your name on discord? The image above was sent in a developer channel there that I can add you to

DanieloV commented 1 month ago

You can find me on discord as DLegend. I noticed the number 1 and that was fixed with the beforeDestroyed -> beforeUnmount change which was required by the vue update from 2 to 3. I can't seem to replicate the point 2 either. Tried spectating and then using browser navigation in and out and it worked ok. Let me know if you can still replicate it and what are the steps.

DanieloV commented 3 weeks ago

@sindreslungaard for when you have time this has also been ready for review again. And once this and the https://github.com/sindreslungaard/duel-masters/pull/224 are merged, the development for other frontend related stuff can go somewhat smoother.

sindreslungaard commented 2 weeks ago

👍i'll have a look at this and the other PRs when I get back from vacation next week