While testing the system for the video, I saw major issues with async updates and hacked a temporary fix into the updateAnnotation function (after an async edit completes, we completely ignore the value in this.annotations and overwrite with our own value)
|
public async updateAnnotation(document: vscode.TextDocument, updatedAnnotation: Annotation): Promise<void> { |
. This probably risks losing data if a bad sequence of async updates occurs.
Instead, we should process updates synchronously. This may require forming an update queue or throwing away updates that occur when the system is busy.
There's a separate issue of many update calls being triggered after a single user action due to reactive updating. This should be documented on this issue. Ideally, the logic should be carefully re-coded to limit reactions to cases where they are necessary.
While testing the system for the video, I saw major issues with async updates and hacked a temporary fix into the updateAnnotation function (after an async edit completes, we completely ignore the value in this.annotations and overwrite with our own value)
magic-markup/vscode-extension/src/AnnotationTracker.ts
Line 629 in 99afa08
Instead, we should process updates synchronously. This may require forming an update queue or throwing away updates that occur when the system is busy.
There's a separate issue of many update calls being triggered after a single user action due to reactive updating. This should be documented on this issue. Ideally, the logic should be carefully re-coded to limit reactions to cases where they are necessary.