#768 bugfix 404 error briefly shown #805

Merged
a22erigr merged 1 commit from #768-404-error-in-temp-sensor into team_2_week_5 2026-05-07 13:23:45 +00:00
Collaborator

Regarding issue #768: 404 error briefly shown.

Problems: 1. Fix bug where a 404 error is shown on first render.

Solution: 1. Changed from 'any' in initial state to null which was the issue. When rendering it goes in the following order: it goes from top to down, but first all useStates --> everything else --> all useEffects. 'Any' was used before to call a random sensor in earlier patches, but has since been removed and does not work anymore. The initial state could not either be set as, for example "A-Building" since the sensor name could change in the future. Therefore it is set as null and made a return statement in useApi where if no apiurl is entered (null), it will return nothing.

Regarding issue [#768](https://git.webug.se/Andras/BoundlessFlowCampus2K/issues/768): 404 error briefly shown. Problems: 1. Fix bug where a 404 error is shown on first render. Solution: 1. Changed from 'any' in initial state to null which was the issue. When rendering it goes in the following order: it goes from top to down, but first all useStates --> everything else --> all useEffects. 'Any' was used before to call a random sensor in earlier patches, but has since been removed and does not work anymore. The initial state could not either be set as, for example "A-Building" since the sensor name could change in the future. Therefore it is set as null and made a return statement in useApi where if no apiurl is entered (null), it will return nothing.
Added a null return statement.
a22erigr 2026-05-07 09:18:56 +00:00
Collaborator

Review on #805

Whats done

Tested on macOS using Chrome

  • App starts
    • Refreshed the page multiple times
    • Verified that the temporary 404 error is no longer shown on first render
    • Checkde that temperature data loads correctly

Inspected following files

  • TemperatureView.js

    • Indentation/code styling
      • Follows standard
    • Naming convention
      • Follows standard
    • Comments
      • Looks good
    • General code quality
      • No issues found, sensor id is now set after sensor data is loaded
  • useTemperature.js

    • Indentation/code styling
      + Follows standard
      • Naming convention
        • Follows standard
      • Comments
        • Looks good
      • General code quality
        • only loads temperature data when a sensor exits
  • sharedFeatures.js

    • Indentation/code styling
      + Follows standard
      • Naming convention
        • Follows standard
      • General code quality
        • No issues found

What needs to be done

  • No issues found

Conclusion

  • Works as intended and the code is ready to be merged.
# Review on #805 ## Whats done ### Tested on macOS using Chrome + App starts + Refreshed the page multiple times + Verified that the temporary 404 error is no longer shown on first render + Checkde that temperature data loads correctly ### Inspected following files + TemperatureView.js + Indentation/code styling + Follows standard + Naming convention + Follows standard + Comments + Looks good + General code quality + No issues found, sensor id is now set after sensor data is loaded + useTemperature.js + Indentation/code styling + Follows standard + Naming convention + Follows standard + Comments + Looks good + General code quality + only loads temperature data when a sensor exits + sharedFeatures.js + Indentation/code styling + Follows standard + Naming convention + Follows standard + General code quality + No issues found ## What needs to be done + No issues found ## Conclusion + Works as intended and the code is ready to be merged.
a22erigr merged commit e1a6271068 into team_2_week_5 2026-05-07 13:23:45 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Andras/BoundlessFlowCampus2K!805
No description provided.