Skip to content

Commit

Permalink
Remove return type
Browse files Browse the repository at this point in the history
  • Loading branch information
zoontek committed Dec 6, 2024
1 parent 999480e commit 9868ed5
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions packages/lake/src/hooks/usePersistedState.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { Option, Result } from "@swan-io/boxed";
import { useCallback, useEffect, useMemo, useState } from "react";

const getItem = (key: string): string | null =>
Result.fromExecution(() => localStorage.getItem(key)).getOr(null);
const getItem = (key: string) => Result.fromExecution(() => localStorage.getItem(key)).getOr(null);

const setItem = (key: string, value: string | null) => {
try {
Expand Down Expand Up @@ -59,8 +58,7 @@ export const usePersistedState = <T>(key: string, defaultValue: T) => {
useEffect(() => {
const listener = (event: StorageEvent) => {
if (event.storageArea === localStorage && (event.key === key || event.key === null)) {
const rawValue = getItem(key);
setRawValue(rawValue);
setRawValue(getItem(key));
}
};

Expand Down

0 comments on commit 9868ed5

Please sign in to comment.