Batch mark/unmark files as viewed#4700
Conversation
3548060 to
36e6697
Compare
36e6697 to
739a5bb
Compare
alexr00
left a comment
There was a problem hiding this comment.
Thank you for the PR! It looks like its heading in a very good direction! I have a few questions/comments.
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! |
a743283 to
721e2ff
Compare
alexr00
left a comment
There was a problem hiding this comment.
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. |
4c619ba to
0ff6cd2
Compare
0ff6cd2 to
21e18b0
Compare
|
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. |
|
@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. |
src/view/treeNodes/treeNode.ts
Outdated
|
|
||
| updateFromCheckboxChanged(_newState: vscode.TreeItemCheckboxState): void { } | ||
|
|
||
| static processCheckboxUpdates(checkboxUpdates: vscode.TreeCheckboxChangeEvent<TreeNode>) { |
There was a problem hiding this comment.
Probably not the ideal place for this. I wanted somewhere easily accessible for both prChangesTreeDataProvider and prsTreeDataProvider. Where would you recommend I put it?
There was a problem hiding this comment.
There isn't an existing place that this fits nicely. Let's put it in a new treeUtils.ts file next to treeNode.ts.
src/view/treeNodes/treeNode.ts
Outdated
| }); | ||
|
|
||
| if (checkedNodes.length > 0) { | ||
| const prModel = checkedNodes[0].pullRequest; |
There was a problem hiding this comment.
Is it safe to assume that all nodes will be associated with the same PR?
alexr00
left a comment
There was a problem hiding this comment.
Thanks for making this change! In the interest of getting this PR merged today, I've pushed the changes I suggested in my comments.
src/github/pullRequestModel.ts
Outdated
|
|
||
| this.setFileViewedState(fileName, ViewedState.VIEWED, event); | ||
| } | ||
| private readonly BATCH_SIZE = 100; |
There was a problem hiding this comment.
nit: this can be a const outside of the class so that it can be inlined during compilation.
src/view/treeNodes/treeNode.ts
Outdated
| }); | ||
|
|
||
| if (checkedNodes.length > 0) { | ||
| const prModel = checkedNodes[0].pullRequest; |
src/view/treeNodes/treeNode.ts
Outdated
|
|
||
| updateFromCheckboxChanged(_newState: vscode.TreeItemCheckboxState): void { } | ||
|
|
||
| static processCheckboxUpdates(checkboxUpdates: vscode.TreeCheckboxChangeEvent<TreeNode>) { |
There was a problem hiding this comment.
There isn't an existing place that this fits nicely. Let's put it in a new treeUtils.ts file next to treeNode.ts.
|
Thanks @alexr00! |
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