Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Collect webview messages async #4405

Merged
merged 3 commits into from
Aug 3, 2023
Merged

Collect webview messages async #4405

merged 3 commits into from
Aug 3, 2023

Conversation

mattseddon
Copy link
Member

@mattseddon mattseddon commented Aug 3, 2023

Follow up to #4402 (comment)

This PR makes the collection of experiments and plots webview messages async.

stub(dvcReader, 'dag').resolves('')

const pipeline = buildExperimentsPipeline({
const { experiments, messageSpy } = await buildExperimentsWebview({
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[F] After reading this test I had no idea why it didn't use the builder so moved it across.


messageSpy.resetHistory()

const movedGroup = 'params:params.yaml'

const tableChangePromise = experimentsUpdatedEvent(experiments)
const messageSent = waitForSpyCall(messageSpy, messageSpy.callCount)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[F] I had to add this new util as the data for the message is now gathered async.

Copy link
Member Author

@mattseddon mattseddon Aug 3, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where possible we still rely on the old util (experimentsUpdatedEvent(experiments))

const selectedColumns = this.columns.getSelected()

const showOnlyChanged = this.columns.getShowOnlyChanged()
private async getWebviewData(): Promise<TableData> {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function getWebviewData has 62 lines of code (exceeds 40 allowed). Consider refactoring.

@mattseddon mattseddon force-pushed the collect-message-async branch from eadc12e to 3251d1d Compare August 3, 2023 02:19
@mattseddon mattseddon force-pushed the collect-message-async branch from 3251d1d to 6096ba7 Compare August 3, 2023 03:34
@mattseddon mattseddon changed the title Collect experiments webview message async Collect webview messages async Aug 3, 2023
selectedRevisions,
template: this.getTemplatePlots(selectedRevisions)
})
const webview = this.getWebview()
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[F] although this function is duplicated it is not worth the hassle that a base class would bring

@mattseddon mattseddon force-pushed the collect-message-async branch from 6096ba7 to 52b45dd Compare August 3, 2023 03:41
@@ -68,9 +68,13 @@ export class WebviewMessages {
this.update = update
}

public sendWebviewMessage() {
public async sendWebviewMessage() {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Identical blocks of code found in 2 locations. Consider refactoring.

@mattseddon mattseddon marked this pull request as ready for review August 3, 2023 04:23
Copy link
Contributor

@julieg18 julieg18 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work!

@codeclimate
Copy link

codeclimate bot commented Aug 3, 2023

Code Climate has analyzed commit d880a15 and detected 3 issues on this pull request.

Here's the issue category breakdown:

Category Count
Complexity 1
Duplication 2

The test coverage on the diff in this pull request is 100.0% (85% is the threshold).

This pull request will bring the total coverage in the repository to 95.3% (0.0% change).

View more on Code Climate.

@mattseddon mattseddon enabled auto-merge (squash) August 3, 2023 23:09
@mattseddon mattseddon merged commit 49fc1bb into main Aug 3, 2023
@mattseddon mattseddon deleted the collect-message-async branch August 3, 2023 23:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants