Fix "Always expand running logs" behavior on subsequent updates #34964
+473
−7
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.
Summary
Fixes the "Always expand running logs" setting behavior so that it properly auto-expands running log steps on subsequent job updates, not just on the initial page load.
Problem
Currently, the "Always expand running logs" setting only works when the Actions page is first loaded (
isFirstLoad = true
). If a a running step is collapsed, or if a step transitions from "waiting" to "running" status during subsequent job updates, the logs do not auto-expand even though the setting is enabled.Solution
Modified
RepoActionView.vue
to:Test Coverage
Added basic tests (☹️ .
RepoActionView.autoExpand.test.ts
) to reproduce buggy behavior. This was challenging because of how the Vue component is currently written - introduced a (hopefully) minor refactoring to simplify mocking theloadJobData
function by optionally allowing injection of it. Also removed a check of theabortController
that I think is unnecessary -if (this.loadingAbortController !== abortController) return
-- this was really making the testing difficult and I'm not 100% sure what was going on behind the scenes to make it so, but according to the MDN docs, this line shouldn't be necessary - the line to read from the response,await resp.json()
will fail with an AbortError if the request was aborted at any point before the response is read. There's already try/catch handling of the AbortError further down, so this should still be handled. Apologies if I'm parsing this wrong, it just seems impossible to get a component test past this line otherwiseChanges Made
web_src/js/components/RepoActionView.vue
: Enhanced theloadJob
method to handle auto-expansion on all updatesweb_src/js/components/RepoActionView.autoExpand.test.ts
: Added focused tests for the auto-expand functionalitypackage.json
/package-lock.json
: Added@vue/test-utils
dependency for testingp.s. interestingly when I was testing this "live", I found that with the auto-expand behavior working, the current auto-scroll logs (see #34957) worked better ... until it got to a long step that was updating a lot ... then it broke again, so I think #34957 is still needed.