Skip to content

Conversation

@joshuaobrien
Copy link
Contributor

@joshuaobrien joshuaobrien commented Apr 3, 2023

Context

Previously, when marking/unmarking a folder as viewed, a request was sent for every single file. This PR ensures that only one request is sent when marking/unmarking a folder as viewed.

Fixes #4520

Before

batch-before.mp4

After

batch-after.mp4
@joshuaobrien joshuaobrien force-pushed the batch-view-unview-reqs branch from 3548060 to 36e6697 Compare April 3, 2023 12:47
@joshuaobrien joshuaobrien force-pushed the batch-view-unview-reqs branch from 36e6697 to 739a5bb Compare April 3, 2023 12:49
Copy link
Member

@alexr00 alexr00 left a comment

Choose a reason for hiding this comment

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

Thank you for the PR! It looks like its heading in a very good direction! I have a few questions/comments.

@alexr00 alexr00 added this to the April 2023 milestone Apr 13, 2023
@alexr00 alexr00 removed this from the April 2023 milestone Apr 25, 2023
@joshuaobrien
Copy link
Contributor Author

I'm not a fan of this inlining. Is it possible to do without the inlining and instead have a new query in queries.gql

I spent a bit of time investigating this before raising this PR, but I couldn't find a way to do it. That said, I've never used graphql before outside of this project so I'm sure I'm missing something. I'll take another look this evening!

@alexr00 alexr00 added this to the May 2023 milestone Apr 26, 2023
@joshuaobrien joshuaobrien force-pushed the batch-view-unview-reqs branch from a743283 to 721e2ff Compare April 26, 2023 14:44
Copy link
Member

@alexr00 alexr00 left a comment

Choose a reason for hiding this comment

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

Thanks for the updates! In the future, it would make reviewing PRs much easier/faster for me if you don't force push your branch. It's hard to tell which files have changed since my last review after a force push.

I tested this out and it doesn't seem to work. I get this error:

stack trace: GraphQLError: Syntax Error: Cannot parse the unexpected character ".".
    at syntaxError (d:\repos\Microsoft\vscode-pull-request-github-2\dist\webpack:\vscode-pull-request-github\node_modules\graphql\error\syntaxError.js:15:1)
    at readToken (d:\repos\Microsoft\vscode-pull-request-github-2\dist\webpack:\vscode-pull-request-github\node_modules\graphql\language\lexer.js:360:1)
    at Lexer.lookahead (d:\repos\Microsoft\vscode-pull-request-github-2\dist\webpack:\vscode-pull-request-github\node_modules\graphql\language\lexer.js:75:1)
    at Lexer.advance (d:\repos\Microsoft\vscode-pull-request-github-2\dist\webpack:\vscode-pull-request-github\node_modules\graphql\language\lexer.js:58:1)
    at Parser.expectToken (d:\repos\Microsoft\vscode-pull-request-github-2\dist\webpack:\vscode-pull-request-github\node_modules\graphql\language\parser.js:1408:1)
    at Parser.parseName (d:\repos\Microsoft\vscode-pull-request-github-2\dist\webpack:\vscode-pull-request-github\node_modules\graphql\language\parser.js:98:1)
    at Parser.parseField (d:\repos\Microsoft\vscode-pull-request-github-2\dist\webpack:\vscode-pull-request-github\node_modules\graphql\language\parser.js:295:1)
    at Parser.parseSelection (d:\repos\Microsoft\vscode-pull-request-github-2\dist\webpack:\vscode-pull-request-github\node_modules\graphql\language\parser.js:284:1)
    at Parser.many (d:\repos\Microsoft\vscode-pull-request-github-2\dist\webpack:\vscode-pull-request-github\node_modules\graphql\language\parser.js:1523:1)
    at Parser.parseSelectionSet (d:\repos\Microsoft\vscode-pull-request-github-2\dist\webpack:\vscode-pull-request-github\node_modules\graphql\language\parser.js:271:1)
    at Parser.parseOperationDefinition (d:\repos\Microsoft\vscode-pull-request-github-2\dist\webpack:\vscode-pull-request-github\node_modules\graphql\language\parser.js:199:1)
    at Parser.parseDefinition (d:\repos\Microsoft\vscode-pull-request-github-2\dist\webpack:\vscode-pull-request-github\node_modules\graphql\language\parser.js:137:1)
    at Parser.many (d:\repos\Microsoft\vscode-pull-request-github-2\dist\webpack:\vscode-pull-request-github\node_modules\graphql\language\parser.js:1523:1)
    at Parser.parseDocument (d:\repos\Microsoft\vscode-pull-request-github-2\dist\webpack:\vscode-pull-request-github\node_modules\graphql\language\parser.js:115:1)
    at parse (d:\repos\Microsoft\vscode-pull-request-github-2\dist\webpack:\vscode-pull-request-github\node_modules\graphql\language\parser.js:31:1)
    at parseDocument (d:\repos\Microsoft\vscode-pull-request-github-2\dist\webpack:\vscode-pull-request-github\node_modules\graphql-tag\src\index.js:129:1)
    at gql (d:\repos\Microsoft\vscode-pull-request-github-2\dist\webpack:\vscode-pull-request-github\node_modules\graphql-tag\src\index.js:170:1)
    at _PullRequestModel.markFilesAsViewed (d:\repos\Microsoft\vscode-pull-request-github-2\dist\webpack:\vscode-pull-request-github\src\github\pullRequestModel.ts:1629:23)
extensionHostProcess.js:105
unhandledRejection {"message":"Syntax Error: Cannot parse the unexpected character \".\".","locations":[{"line":2,"column":25}]}
extensionHostProcess.js:105
rejected promise not handled within 1 second: Syntax Error: Cannot parse the unexpected character ".".
@joshuaobrien
Copy link
Contributor Author

Thanks for the updates! In the future, it would make reviewing PRs much easier/faster for me if you don't force push your branch. It's hard to tell which files have changed since my last review after a force push.

I tested this out and it doesn't seem to work. I get this error:

stack trace: GraphQLError: Syntax Error: Cannot parse the unexpected character ".".
    at syntaxError (d:\repos\Microsoft\vscode-pull-request-github-2\dist\webpack:\vscode-pull-request-github\node_modules\graphql\error\syntaxError.js:15:1)
    at readToken (d:\repos\Microsoft\vscode-pull-request-github-2\dist\webpack:\vscode-pull-request-github\node_modules\graphql\language\lexer.js:360:1)
    at Lexer.lookahead (d:\repos\Microsoft\vscode-pull-request-github-2\dist\webpack:\vscode-pull-request-github\node_modules\graphql\language\lexer.js:75:1)
    at Lexer.advance (d:\repos\Microsoft\vscode-pull-request-github-2\dist\webpack:\vscode-pull-request-github\node_modules\graphql\language\lexer.js:58:1)
    at Parser.expectToken (d:\repos\Microsoft\vscode-pull-request-github-2\dist\webpack:\vscode-pull-request-github\node_modules\graphql\language\parser.js:1408:1)
    at Parser.parseName (d:\repos\Microsoft\vscode-pull-request-github-2\dist\webpack:\vscode-pull-request-github\node_modules\graphql\language\parser.js:98:1)
    at Parser.parseField (d:\repos\Microsoft\vscode-pull-request-github-2\dist\webpack:\vscode-pull-request-github\node_modules\graphql\language\parser.js:295:1)
    at Parser.parseSelection (d:\repos\Microsoft\vscode-pull-request-github-2\dist\webpack:\vscode-pull-request-github\node_modules\graphql\language\parser.js:284:1)
    at Parser.many (d:\repos\Microsoft\vscode-pull-request-github-2\dist\webpack:\vscode-pull-request-github\node_modules\graphql\language\parser.js:1523:1)
    at Parser.parseSelectionSet (d:\repos\Microsoft\vscode-pull-request-github-2\dist\webpack:\vscode-pull-request-github\node_modules\graphql\language\parser.js:271:1)
    at Parser.parseOperationDefinition (d:\repos\Microsoft\vscode-pull-request-github-2\dist\webpack:\vscode-pull-request-github\node_modules\graphql\language\parser.js:199:1)
    at Parser.parseDefinition (d:\repos\Microsoft\vscode-pull-request-github-2\dist\webpack:\vscode-pull-request-github\node_modules\graphql\language\parser.js:137:1)
    at Parser.many (d:\repos\Microsoft\vscode-pull-request-github-2\dist\webpack:\vscode-pull-request-github\node_modules\graphql\language\parser.js:1523:1)
    at Parser.parseDocument (d:\repos\Microsoft\vscode-pull-request-github-2\dist\webpack:\vscode-pull-request-github\node_modules\graphql\language\parser.js:115:1)
    at parse (d:\repos\Microsoft\vscode-pull-request-github-2\dist\webpack:\vscode-pull-request-github\node_modules\graphql\language\parser.js:31:1)
    at parseDocument (d:\repos\Microsoft\vscode-pull-request-github-2\dist\webpack:\vscode-pull-request-github\node_modules\graphql-tag\src\index.js:129:1)
    at gql (d:\repos\Microsoft\vscode-pull-request-github-2\dist\webpack:\vscode-pull-request-github\node_modules\graphql-tag\src\index.js:170:1)
    at _PullRequestModel.markFilesAsViewed (d:\repos\Microsoft\vscode-pull-request-github-2\dist\webpack:\vscode-pull-request-github\src\github\pullRequestModel.ts:1629:23)
extensionHostProcess.js:105
unhandledRejection {"message":"Syntax Error: Cannot parse the unexpected character \".\".","locations":[{"line":2,"column":25}]}
extensionHostProcess.js:105
rejected promise not handled within 1 second: Syntax Error: Cannot parse the unexpected character ".".

Huh okay. I'll see if I can reproduce that locally. I'll push up a fix if I can.

@alexr00 alexr00 modified the milestones: May 2023, Backlog May 30, 2023
@joshuaobrien joshuaobrien force-pushed the batch-view-unview-reqs branch from 4c619ba to 0ff6cd2 Compare November 26, 2023 06:12
@joshuaobrien joshuaobrien force-pushed the batch-view-unview-reqs branch from 0ff6cd2 to 21e18b0 Compare November 26, 2023 06:23
@joshuaobrien
Copy link
Contributor Author

This completely dropped off my radar. I'll fix it up and send it back for review soon.

Given how long it's been, I rebased my branch rather than have a massive merge commit. This required a force push, sorry. I won't force push for any further changes.

@alexr00
Copy link
Member

alexr00 commented Nov 28, 2023

@joshuaobrien very good timing, thanks for reviving the change! We are doing issue/pr clean up in December and your PR is at the top of my list of my list.

@alexr00 alexr00 modified the milestones: Backlog, December 2023 Nov 28, 2023
@joshuaobrien joshuaobrien marked this pull request as draft December 3, 2023 06:09

updateFromCheckboxChanged(_newState: vscode.TreeItemCheckboxState): void { }

static processCheckboxUpdates(checkboxUpdates: vscode.TreeCheckboxChangeEvent<TreeNode>) {
Copy link
Contributor Author

@joshuaobrien joshuaobrien Dec 3, 2023

Choose a reason for hiding this comment

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

Probably not the ideal place for this. I wanted somewhere easily accessible for both prChangesTreeDataProvider and prsTreeDataProvider. Where would you recommend I put it?

Copy link
Member

Choose a reason for hiding this comment

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

There isn't an existing place that this fits nicely. Let's put it in a new treeUtils.ts file next to treeNode.ts.

});

if (checkedNodes.length > 0) {
const prModel = checkedNodes[0].pullRequest;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is it safe to assume that all nodes will be associated with the same PR?

Copy link
Member

Choose a reason for hiding this comment

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

Should be!

@joshuaobrien joshuaobrien marked this pull request as ready for review December 3, 2023 10:20
@joshuaobrien joshuaobrien requested a review from alexr00 December 3, 2023 10:21
@joaomoreno joaomoreno removed this from the December 2023 milestone Dec 11, 2023
@alexr00 alexr00 added this to the December / January 2024 milestone Dec 12, 2023
Copy link
Member

@alexr00 alexr00 left a comment

Choose a reason for hiding this comment

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

Thanks for making this change! In the interest of getting this PR merged today, I've pushed the changes I suggested in my comments.


this.setFileViewedState(fileName, ViewedState.VIEWED, event);
}
private readonly BATCH_SIZE = 100;
Copy link
Member

Choose a reason for hiding this comment

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

nit: this can be a const outside of the class so that it can be inlined during compilation.

});

if (checkedNodes.length > 0) {
const prModel = checkedNodes[0].pullRequest;
Copy link
Member

Choose a reason for hiding this comment

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

Should be!


updateFromCheckboxChanged(_newState: vscode.TreeItemCheckboxState): void { }

static processCheckboxUpdates(checkboxUpdates: vscode.TreeCheckboxChangeEvent<TreeNode>) {
Copy link
Member

Choose a reason for hiding this comment

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

There isn't an existing place that this fits nicely. Let's put it in a new treeUtils.ts file next to treeNode.ts.

@alexr00 alexr00 enabled auto-merge (squash) December 12, 2023 11:48
@joshuaobrien
Copy link
Contributor Author

Thanks @alexr00!

@alexr00 alexr00 merged commit b888b3f into microsoft:main Dec 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

4 participants