Simplify refresh handling by removing DataContext fetch abstraction#165
Open
hemannt003 wants to merge 1 commit intoc2siorg:mainfrom
Open
Simplify refresh handling by removing DataContext fetch abstraction#165hemannt003 wants to merge 1 commit intoc2siorg:mainfrom
hemannt003 wants to merge 1 commit intoc2siorg:mainfrom
Conversation
…owns fake fetch logic, and each data panel now fetches locally when refresh is triggered. What changed In webapp/src/context/DataContext.jsx: Removed the context-level fetchData function entirely. Removed useCallback/useEffect tied to that function. Removed now-dead helper runCommandInTerminal. Kept refresh + setRefresh as shared signal state (along with existing app state already used elsewhere, to avoid UI regressions). In refresh-driven components: webapp/src/components/Stack/Stack.jsx webapp/src/components/GdbComponents/BreakPoints/BreakPoints.jsx webapp/src/components/Functions/Functions.jsx webapp/src/components/GdbComponents/MemoryMap/MemoryMap.jsx Each now follows the same pattern: Guard early: if (!refresh) return; Run API call in local fetchData inside useEffect. Keep existing API endpoint/state updates. Reset refresh in finally with a safe functional guard: setRefresh((prev) => (prev ? false : prev)); Cleanup: Removed unused useState import in BreakPoints. Behavior and safety No central fake fetch/reset abstraction remains. Refresh-triggered data loading still works from each component. No infinite loop introduced (useEffect exits when refresh is false). Added safe reset guard so multiple components trying to reset won’t conflict.
Author
|
Hi @Shubh942 Could you please review the PR whenever you get time and let me know for any changes to be made. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixws issue #163
Description
This PR removes misleading refresh logic from DataContext and makes refresh-triggered API fetching local to each consumer component.
What changed
Removed fetchData from DataContext (it did not fetch anything and only reset refresh).
Removed useEffect/useCallback in DataContext that were tied to that function.
Kept refresh and setRefresh as the shared signal mechanism.
Updated refresh consumers to own their own refresh fetch logic:
- Stack
- BreakPoints
- Functions
- MemoryMap
Standardized each component to:
early-return when refresh is false
perform existing API call locally
reset refresh in finally to avoid stuck refresh state
Removed dead/unused imports related to the old abstraction.
Additional context