Skip to content

Commit

Permalink
fix users in user list not getting updated on login/logout (#1582)
Browse files Browse the repository at this point in the history
fixes #1547
  • Loading branch information
dyc3 authored Mar 31, 2024
1 parent d5e224b commit 7ba3c23
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
20 changes: 20 additions & 0 deletions client/src/components/WorkaroundUserStateNotifier.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<script lang="ts" setup>
import { onUnmounted } from "vue";
import { useConnection } from "@/plugins/connection";
import { useRoomApi } from "@/util/roomapi";
import { useStore } from "@/store";
const connection = useConnection();
const roomapi = useRoomApi(connection);
const store = useStore();
const loginUnsub = store.subscribe(mutation => {
if (mutation.type === "LOGIN" || mutation.type === "LOGOUT") {
roomapi.notify("usernameChanged");
}
});
onUnmounted(() => {
loginUnsub();
});
</script>
3 changes: 3 additions & 0 deletions client/src/views/Room.vue
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@
</v-overlay>
<ServerMessageHandler />
<WorkaroundPlaybackStatusUpdater />
<WorkaroundUserStateNotifier />
</div>
</template>

Expand Down Expand Up @@ -224,6 +225,7 @@ import { useConnection } from "@/plugins/connection";
import { useRoomApi } from "@/util/roomapi";
import ServerMessageHandler from "@/components/ServerMessageHandler.vue";
import WorkaroundPlaybackStatusUpdater from "@/components/WorkaroundPlaybackStatusUpdater.vue";
import WorkaroundUserStateNotifier from "@/components/WorkaroundUserStateNotifier.vue";
import { useStore } from "@/store";
import { useI18n } from "vue-i18n";
import { useRouter, useRoute } from "vue-router";
Expand Down Expand Up @@ -255,6 +257,7 @@ export default defineComponent({
RoomDisconnected,
ServerMessageHandler,
WorkaroundPlaybackStatusUpdater,
WorkaroundUserStateNotifier,
RestoreQueue,
VoteSkip,
},
Expand Down

0 comments on commit 7ba3c23

Please sign in to comment.