Skip to content

Commit

Permalink
Merge pull request #1874 from quadratichq/ayush/viewport_buffer_bug
Browse files Browse the repository at this point in the history
fix: rendering bug due to slow viewport buffer update
  • Loading branch information
davidkircos authored Sep 19, 2024
2 parents e1a4e09 + 40f5164 commit 16265bc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
6 changes: 3 additions & 3 deletions quadratic-core/src/controller/send_render.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use super::{
};

impl GridController {
fn send_render_cells_from_hash(&self, sheet_id: SheetId, modified: HashSet<Pos>) {
pub fn send_render_cells_from_hash(&self, sheet_id: SheetId, modified: &HashSet<Pos>) {
// send the modified cells to the render web worker
modified.iter().for_each(|modified| {
if let Some(sheet) = self.try_sheet(sheet_id) {
Expand Down Expand Up @@ -56,7 +56,7 @@ impl GridController {
});
}
}
self.send_render_cells_from_hash(sheet_rect.sheet_id, modified);
self.send_render_cells_from_hash(sheet_rect.sheet_id, &modified);

Check warning on line 59 in quadratic-core/src/controller/send_render.rs

View check run for this annotation

Codecov / codecov/patch

quadratic-core/src/controller/send_render.rs#L59

Added line #L59 was not covered by tests
}

/// Sends the modified cell sheets to the render web worker based on a
Expand Down Expand Up @@ -84,7 +84,7 @@ impl GridController {
}
}
}
self.send_render_cells_from_hash(selection.sheet_id, modified);
self.send_render_cells_from_hash(selection.sheet_id, &modified);
}

pub fn send_render_borders(&self, sheet_id: SheetId) {
Expand Down
6 changes: 6 additions & 0 deletions quadratic-core/src/controller/viewport.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,12 @@ impl GridController {
.dirty_hashes
.insert(viewport_sheet_id, remaining_hashes);
}
} else {
for (&sheet_id, dirty_hashes) in transaction.dirty_hashes.iter_mut() {
self.send_render_cells_from_hash(sheet_id, dirty_hashes);
dirty_hashes.clear();
}
transaction.dirty_hashes.clear();

Check warning on line 119 in quadratic-core/src/controller/viewport.rs

View check run for this annotation

Codecov / codecov/patch

quadratic-core/src/controller/viewport.rs#L115-L119

Added lines #L115 - L119 were not covered by tests
}
}

Check warning on line 121 in quadratic-core/src/controller/viewport.rs

View check run for this annotation

Codecov / codecov/patch

quadratic-core/src/controller/viewport.rs#L121

Added line #L121 was not covered by tests
}
Expand Down

0 comments on commit 16265bc

Please sign in to comment.