Skip to content

Commit d822ed2

Browse files
committed
Debugging4
1 parent 9c7bf3d commit d822ed2

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

app/source/library/game/GamePage.svelte

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
import api from "../../api";
5555
import type { Round } from "../../api/resourceObjects";
5656
import MapWrapper from "./MapWrapper.svelte";
57+
import subscribeIfNotDeepEqual from "../utilities/subscribeIfNotDeepEqual";
5758
5859
export let unhandledError: Error | null = null;
5960
@@ -190,7 +191,7 @@
190191
191192
// To be safe, complete the round when the final question is complete
192193
unsubscribers.push(
193-
currentQuestion.subscribe((value) => {
194+
subscribeIfNotDeepEqual(currentQuestion, (value) => {
194195
console.debug("currentQuestion subscribe", value);
195196
if (
196197
value &&
@@ -214,7 +215,7 @@
214215
);
215216
216217
unsubscribers.push(
217-
gameRound.subscribe((value) => {
218+
subscribeIfNotDeepEqual(gameRound, (value) => {
218219
console.debug("gameRound subscribe", value);
219220
if (!value) {
220221
return;

app/source/library/utilities/subscribeIfNotDeepEqual.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export default function subscribeIfNotDeepEqual<T>(
1717
) {
1818
let oldValue: T;
1919

20-
store.subscribe((newValue) => {
20+
return store.subscribe((newValue) => {
2121
if (!isEqual(oldValue, newValue)) {
2222
if (debugName) {
2323
console.debug(`[${debugName}] changed`, oldValue, newValue);

0 commit comments

Comments
 (0)