Skip to content

refactor(web): migrate debug model config storage#37028

Open
popsiclelmlm wants to merge 2 commits into
langgenius:mainfrom
popsiclelmlm:refactor/debug-model-config-local-storage
Open

refactor(web): migrate debug model config storage#37028
popsiclelmlm wants to merge 2 commits into
langgenius:mainfrom
popsiclelmlm:refactor/debug-model-config-local-storage

Conversation

@popsiclelmlm
Copy link
Copy Markdown
Contributor

Summary

Part of #36898.

Summary

Migrates the app-debug-with-single-or-multiple-models storage concern in the app debug configuration hook from direct localStorage access to useLocalStorage. This keeps the PR to one vertical area and avoids overlapping with the existing countdown and need-refresh migrations.

Reproduction

web/app/components/app/configuration/debug/hooks.tsx reads and writes app-debug-with-single-or-multiple-models directly with localStorage.getItem / localStorage.setItem.

Root cause

The hook still handled JSON serialization manually instead of using the shared @/hooks/use-local-storage API requested in #36898.

Changes

  • Replaced direct JSON parse/stringify localStorage handling with useLocalStorage<DebugWithSingleOrMultipleModelConfigs>.
  • Added a regression test for initializing multiple-model debug settings from existing local storage.
  • Removed the now-obsolete no-restricted-globals suppression for the migrated hook.

Tests

  • git diff --check
  • node -e "JSON.parse(require('fs').readFileSync('eslint-suppressions.json', 'utf8'))"
  • rg -n "localStorage" web/app/components/app/configuration/debug/hooks.tsx || true
  • Attempted: pnpm -C web test app/components/app/configuration/debug/__tests__/hooks.spec.tsx
    • Blocked locally before project tests started by Corepack pnpm signature verification: Cannot find matching keyid.

Screenshots/Logs

Not applicable; refactor-only storage hook change.

Screenshots

Before After
Not applicable Not applicable

Checklist

  • This change requires a documentation update, included: Dify Document
  • I understand that this PR may be closed in case there was no previous discussion or issues. (This doesn't apply to typos!)
  • I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change.
  • I've updated the documentation accordingly.
  • I ran make lint && make type-check (backend) and cd web && pnpm exec vp staged (frontend) to appease the lint gods

From Codex

@dosubot dosubot Bot added size:M This PR changes 30-99 lines, ignoring generated files. refactor labels Jun 3, 2026
@github-actions github-actions Bot added the web This relates to changes on the web. label Jun 3, 2026
@EvanYao826
Copy link
Copy Markdown
Contributor

Hi, I'd like to work on this issue. I'll migrate the app-debug-with-single-or-multiple-models storage in web/app/components/app/configuration/debug/hooks.tsx to use useLocalStorage.

I'll start by examining the current implementation and creating a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refactor size:M This PR changes 30-99 lines, ignoring generated files. web This relates to changes on the web.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants