Browse Source

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
changes/69/840769/1
Clark Boylan 3 weeks ago
parent
commit
1e4cbf3bb1
  1. 5
      web/src/containers/logfile/LogFile.jsx
  2. 2
      web/src/reducers/initialState.js

5
web/src/containers/logfile/LogFile.jsx

@ -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.

2
web/src/reducers/initialState.js

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

Loading…
Cancel
Save