Set logfile isFetching initial state to true

Setting the logfile isFetching initial state to true is more accurate to
reality as when the logfile object is first insantiated it has not been
fetched and is going to be fetched. This is important to ensure our
useEffect() callbacks file and apply at the right times otherwise they
will update values too early, fire, then not fire again when the
fetching is complete. If they fire before fetching is complete then they
do not function.

Change-Id: Ic8cd2e4ab2d2d7fd5f74ff6862f719c0aaa756dc
This commit is contained in:
Clark Boylan 2022-05-05 15:03:09 -07:00
parent f623adefab
commit 1e4cbf3bb1
2 changed files with 6 additions and 1 deletions

View File

@ -59,6 +59,11 @@ export default function LogFile({
// Only highlight the lines if the log is present (otherwise it doesn't make
// sense). Although, scrolling to the selected section only works once the
// necessary log lines are part of the DOM tree.
// Additionally note that if we set highlightStart before the page content
// is available then the window scrolling won't match any lines and we won't
// scroll. Then when we try to set highlightStart after page content is loaded
// the value isn't different than what is set previously preventing the
// scroll event from firing.
if (!isFetching) {
// Get the line numbers to highlight from the URL and directly cast them to
// a number. The substring(1) removes the '#' character.

View File

@ -23,7 +23,7 @@ export default {
logfile: {
// Store files by buildId->filename->content
files: {},
isFetching: false,
isFetching: true,
url: null,
},
auth: {},