fix runtime error - #31
Merged
Merged
Conversation
Owner
Author
|
@VeerajRatrikar @LikhithSP THE PR #30 is not required, made some minor fixes to make it work instead.. |
VeerajRatrikar
approved these changes
Nov 15, 2025
LikhithSP
approved these changes
Nov 15, 2025
Praneeth0526
approved these changes
Nov 15, 2025
Closed
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.
This pull request makes a small but important update to the simulated real-time data changes in the
Dashboardcomponent. The change ensures that the code safely handles cases wheresystemInfomay be null, preventing potential runtime errors.Dashboard.jsto guard against nullsystemInfoby providing default values forcpu_usageandmemory_usageduring updates.What happened (root cause)
data.systemInfoas null:data.systemInfowhen the response arrives.prev.systemInfo.cpu_usageevery 5s.prev.systemInfois null and the interval's updater attempts to readprev.systemInfo.cpu_usage, causing the uncaught runtime error:Why the error appeared only after a few minutes
data.systemInfowas overwritten to null, the next interval tick would crash.What I changed already
systemInfobefore reading properties and to use safe defaults:Recommended additional fixes (pick any or all)
Initialize
systemInfoas a safe default when fetch completessystemInfo, coerce it to a sensible default:Only start the interval after data is available
data.systemInfoand only create the interval if systemInfo is non-null:Defensive rendering across the component
systemInfoelsewhere, e.g.data.systemInfo?.cpu_usage ?? '-'.Add retry/timeout handling for the API
Suggested next action (I can implement it)
systemInfowith defaults on fetch) now? If yes, I will patch the file and restart/rebuild the frontend container and then you can verify the error no longer appears.How to verify locally (commands)
Summary
prev.systemInfowas null when updater ran.systemInfowith defaults on fetch or start interval only after fetch; I can apply either if you want—tell me which and I'll implement it.This pull request improves the reliability of the simulated real-time updates in the
Dashboardpage by guarding against potential null values insystemInfo. This ensures that the dashboard does not crash ifsystemInfois missing or undefined.Robustness improvements to real-time data simulation:
Dashboard.js, thesetDatafunction within the interval now checks for a null or undefinedsystemInfoand provides default values forcpu_usageandmemory_usage, preventing runtime errors during simulation.