jupyterlab / pull-requests

A JupyterLab extension for reviewing GitHub pull requests
BSD 3-Clause "New" or "Revised" License
37 stars 18 forks source link

Discussion in plain text diff will be duplicated when viewport changes #41

Closed fcollonval closed 3 years ago

fcollonval commented 3 years ago

Description

That line should be removed to see the bottom scrollbar and use the ability of codemirror to render only the viewport:

https://github.com/jupyterlab/pull-requests/blob/d2e66e6c30f0458f5c173ebd9e9c59e392ea5499/style/index.css#L154

When removing that style, the viewport event is correctly emitted. This trigger the callback

https://github.com/jupyterlab/pull-requests/blob/d2e66e6c30f0458f5c173ebd9e9c59e392ea5499/src/components/diff/plaintext.ts#L191

And the flaw comes from not checking if the discussion widget is already existing or not. The code should clean discussion for lines outside of the viewport and add discussion only for new displayed lines.

Expected behavior

Discussion are not duplicated in plain text diff.

Context