feat: fix the scope rollover bug

This commit is contained in:
Jonathan Kelley committed 2022-12-12 18:31:30 -08:00
1 parent e4d089fabc
commit d4b6bb8a7b
17 files changed
+591 -360

No files matched your search

+8
View File
@@ -280,6 +280,9 @@ impl VirtualDom {
/// Whenever the VirtualDom "works", it will re-render this scope
pub fn mark_dirty(&mut self, id: ScopeId) {
let height = self.scopes[id.0].height;
println!("marking scope {} dirty with height {}", id.0, height);
self.dirty_scopes.insert(DirtyScope { height, id });
}
@@ -516,6 +519,9 @@ impl VirtualDom {
pub async fn render_with_deadline(&mut self, deadline: impl Future<Output = ()>) -> Mutations {
pin_mut!(deadline);
self.process_events();
println!("rendering with dirty scopes {:#?}", self.dirty_scopes);
loop {
// first, unload any complete suspense trees
for finished_fiber in self.finished_fibers.drain(..) {
@@ -542,6 +548,8 @@ impl VirtualDom {
if let Some(dirty) = self.dirty_scopes.iter().next().cloned() {
self.dirty_scopes.remove(&dirty);
println!("diffing scope {:?}", dirty);
// if the scope is currently suspended, then we should skip it, ignoring any tasks calling for an update
if self.is_scope_suspended(dirty.id) {
continue;