🌱 Create shared useLocalStorage hook and refactor consumers#14168
Conversation
Fixes #14126 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: kubestellar-bot <kubestellar-bot@kubestellar.io>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
✅ Deploy Preview for kubestellarconsole ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
👋 Hey @kubestellar-hive[bot] — thanks for opening this PR!
This is an automated message. |
|
| New file | Suggested test location |
|---|---|
web/src/hooks/useLocalStorage.ts |
web/src/hooks/__tests__/useLocalStorage.test.ts |
Hook test template
// web/src/hooks/__tests__/<HookName>-pure.test.ts
import { describe, it, expect, vi } from 'vitest'
// Mock external deps, then:
import { __testables } from '../<HookName>'
const { myPureHelper } = __testables
describe('myPureHelper', () => {
it('happy path', () => { expect(myPureHelper('input')).toBe('expected') })
})Checked against origin/main. Remove the needs-tests label once tests are added.
|
Thank you for your contribution! Your PR has been merged. Check out what's new:
Stay connected: Slack #kubestellar-dev | Multi-Cluster Survey |
|
Post-merge build verification passed ✅ Both Go and frontend builds compiled successfully against merge commit |
✅ Post-Merge Verification: passedCommit: |
Fixes #14126
Creates a reusable useLocalStorage hook with cross-tab sync and refactors 4 hooks to use it, eliminating ~80 lines of duplicated localStorage boilerplate.