Improve warnings when trying to update outside of pending suspense boundaries on the server (#2575)

* Improve warnings when trying to update outside of pending suspense boundaries on the server

* remove suspense resolve log
This commit is contained in:
Evan Almloff authored and GitHub committed 2024-07-17 19:32:33 -07:00
1 parent 88af3e7eff
commit e794be5d78
14 files changed
+409 -313

No files matched your search

+16 -16
View File
@@ -262,26 +262,26 @@ impl Runtime {
let mut cx = std::task::Context::from_waker(&task.waker);
// update the scope stack
self.push_scope(task.scope);
self.rendering.set(false);
self.current_task.set(Some(id));
// poll the future with the scope on the stack
let poll_result = self.with_scope_on_stack(task.scope, || {
self.rendering.set(false);
self.current_task.set(Some(id));
let poll_result = task.task.borrow_mut().as_mut().poll(&mut cx);
let poll_result = task.task.borrow_mut().as_mut().poll(&mut cx);
if poll_result.is_ready() {
// Remove it from the scope so we dont try to double drop it when the scope dropes
self.get_state(task.scope)
.unwrap()
.spawned_tasks
.borrow_mut()
.remove(&id);
if poll_result.is_ready() {
// Remove it from the scope so we dont try to double drop it when the scope dropes
self.get_state(task.scope)
.unwrap()
.spawned_tasks
.borrow_mut()
.remove(&id);
self.remove_task(id);
}
self.remove_task(id);
}
// Remove the scope from the stack
self.pop_scope();
poll_result
});
self.rendering.set(true);
self.current_task.set(None);