From 79ef25cb3bcefd23fd078e6324b5087073fa6d69 Mon Sep 17 00:00:00 2001 From: freakoverse Date: Mon, 18 Nov 2024 09:15:36 +0000 Subject: [PATCH 1/3] Update src/assets/games/Games_Other.csv --- src/assets/games/Games_Other.csv | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/assets/games/Games_Other.csv b/src/assets/games/Games_Other.csv index d32146e..403b61f 100644 --- a/src/assets/games/Games_Other.csv +++ b/src/assets/games/Games_Other.csv @@ -1,5 +1,7 @@ -Game Name,16 by 9 image,Boxart image -(Unlisted Game),, -Minecraft,,https://image.nostr.build/b75b2d3a7855370230f2976567e2d5f913a567c57ac61adfb60c7e1102f05117.jpg -Vintage Story,,https://image.nostr.build/9efe683d339cc864032a99047ce26b2b5c19fab1ec4dcc6d4db96e2785c44eda.png -Yandere Simulator,,https://image.nostr.build/54ba56b752bb9d411cbdc1d249fa0cb74c6062a305bcd0a70ecacb61b8d50030.png \ No newline at end of file +Game Name,16 by 9 image,Boxart image +(Unlisted Game),, +Minecraft,,https://image.nostr.build/b75b2d3a7855370230f2976567e2d5f913a567c57ac61adfb60c7e1102f05117.jpg +Vintage Story,,https://image.nostr.build/9efe683d339cc864032a99047ce26b2b5c19fab1ec4dcc6d4db96e2785c44eda.png +Yandere Simulator,,https://image.nostr.build/54ba56b752bb9d411cbdc1d249fa0cb74c6062a305bcd0a70ecacb61b8d50030.png +Genshin Impact,,https://image.nostr.build/999fccf93cf16a2e0dd8e6f00595b0ab3b5cc6beff9fe4a52f64f427cce9aedd.jpg +Zenless Zone Zero,,https://image.nostr.build/4a9b9c2cbef619552d0c123f8794286f35710dc7ca1ca0010380a630883eb2ca.jpg \ No newline at end of file From 9a30eae749f88795ac5f841474a68e9e3f169a1f Mon Sep 17 00:00:00 2001 From: freakoverse Date: Mon, 18 Nov 2024 09:18:04 +0000 Subject: [PATCH 2/3] Update src/constants.ts --- src/constants.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/constants.ts b/src/constants.ts index a654aab..56f1bdd 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -25,7 +25,7 @@ export const LANDING_PAGE_DATA = { 'naddr1qvzqqqr4gupzpa9lr76m4zlg88mscue3wvlrp8mcpq3txy0k8cqlnhy2hw6z37x4qqjrzcfc8qurjefn943xyen9956rywp595unjc3h94nxvwfexymxxcfnvdjxxlyq37c', 'naddr1qvzqqqr4gupzpa9lr76m4zlg88mscue3wvlrp8mcpq3txy0k8cqlnhy2hw6z37x4qqjryv3k8qenydpj94nrscmp956xgwtp94snydtz95ekgvphvfnxvvrzvyexzsvsz9y', 'naddr1qvzqqqr4gupzpa9lr76m4zlg88mscue3wvlrp8mcpq3txy0k8cqlnhy2hw6z37x4qq2kwjtwvahns3n0tf8j6kjxggkkz4mff499ge7xzsz', - 'naddr1qvzqqqr4gupzpa9lr76m4zlg88mscue3wvlrp8mcpq3txy0k8cqlnhy2hw6z37x4qq2573jhg9trsu6vgav9gnn4dffkzk2ww3yrjejnc2s' + 'naddr1qvzqqqr4gupzpa9lr76m4zlg88mscue3wvlrp8mcpq3txy0k8cqlnhy2hw6z37x4qqjrycf5vyunyd34943kydn9956rycmp943xydpc95cxge3cvguxgcmyxsmkyzpyj60' ] } // we use this object to check if a user has reacted positively or negatively to a post From 870262fcdc2726846841d25e9d256f140a1ab314 Mon Sep 17 00:00:00 2001 From: enes Date: Mon, 18 Nov 2024 11:52:42 +0100 Subject: [PATCH 3/3] fix(filters): merge defaults and stored value --- src/hooks/useLocalStorage.tsx | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/src/hooks/useLocalStorage.tsx b/src/hooks/useLocalStorage.tsx index 8dc9893..4d1eac2 100644 --- a/src/hooks/useLocalStorage.tsx +++ b/src/hooks/useLocalStorage.tsx @@ -10,11 +10,29 @@ const useLocalStorageSubscribe = (callback: () => void) => { return () => window.removeEventListener('storage', callback) } +function mergeWithInitialValue(storedValue: T, initialValue: T): T { + if (typeof storedValue === 'object' && storedValue !== null) { + return { ...initialValue, ...storedValue } + } + return storedValue +} + export function useLocalStorage( key: string, initialValue: T ): [T, React.Dispatch>] { - const getSnapshot = () => getLocalStorageItem(key, initialValue) + const getSnapshot = () => { + // Get the stored value + const storedValue = getLocalStorageItem(key, initialValue) + + // Parse the value + const parsedStoredValue = JSON.parse(storedValue) + + // Merge the default and the stored in case some of the required fields are missing + return JSON.stringify( + mergeWithInitialValue(parsedStoredValue, initialValue) + ) + } const data = React.useSyncExternalStore(useLocalStorageSubscribe, getSnapshot) @@ -35,7 +53,7 @@ export function useLocalStorage( console.warn(e) } }, - [key, data] + [data, key] ) React.useEffect(() => {