UTDNebula/utd-trends

Surround localStorage gets with a try-catch

オープン

#634 opened on 2026/05/30

 (0 件のコメント) (0 件のリアクション) (0 人の担当者)TypeScript (35 件のフォーク)auto 404
Good First IssueType: Internal

Repository metrics

Stars
 (28 個のスター)
PR merge metrics
 (PR metrics pending)

説明

Issue

Sentry Issue: TRENDS-5X

In src/modules/usePersistantState.tsx there is no try-catch around the localStorage call:

function setFromStorage() {
      const value = localStorage.getItem(key);
      if (!value) {
        if (useDefaultValue) {
          internalSetState(defaultValueRef.current);
        }
        return;

leading to a:

SecurityError: The operation is insecure.
  at t (src/modules/usePersistantState.tsx:15:21)
  at <anonymous> (src/modules/usePersistantState.tsx:31:5)
...
(45 additional frame(s) were not displayed)

  • check if there are other localStorage calls without a try-catch in our codebase
  • ensure errors are handled

コントリビューターガイド