Skip to content

refactor(context): simplify refresh handling#164

Open
alikhere wants to merge 1 commit intoc2siorg:mainfrom
alikhere:refactor/gdbui-refresh-handling
Open

refactor(context): simplify refresh handling#164
alikhere wants to merge 1 commit intoc2siorg:mainfrom
alikhere:refactor/gdbui-refresh-handling

Conversation

@alikhere
Copy link
Copy Markdown

@alikhere alikhere commented Mar 17, 2026

Summary

The fetchData function in DataContext was doing nothing useful — it just flipped refresh back to false inside a try/catch that could never actually throw. This created a pointless useEffectuseCallback → state update cycle on every refresh toggle without fetching any data.

Removed fetchData and the useEffect that called it. The context now just exposes refresh and setRefresh as plain state, and individual components own their own fetch behavior when the flag changes. Also dropped the unused useCallback and useEffect imports since nothing in the file needs them anymore.

How to test

  • cd webapp && npm run test — all Vitest suites pass
  • cd webapp && npm run build — Vite builds successfully
  • cd gdbui_server && python -m unittest discover -s . -p 'flask_test.py'
    — all backend tests pass
  • Open the app and confirm panels that use refresh still update
    correctly when debug commands are triggered

Related Issue

Fixes #163

Notes

@alikhere
Copy link
Copy Markdown
Author

Hi @Shubh942 Could you please review this PR.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Simplify refresh handling in DataContext

1 participant