Bubble errors from the server to the client on suspense boundaries (#2772)

* Bubble errors from the server to the client on suspense boundaries

* make resolving suspense boundaries O(n)
This commit is contained in:
Evan Almloff authored and GitHub committed 2024-08-02 19:01:55 -07:00
1 parent 3003362b52
commit b0a2e2418c
12 files changed
+190 -39

No files matched your search

+6 -6
View File
@@ -190,10 +190,10 @@ impl Scope {
/// Clones the state if it exists.
pub fn consume_context<T: 'static + Clone>(&self) -> Option<T> {
tracing::trace!(
"looking for context {} ({:?}) in {}",
"looking for context {} ({:?}) in {:?}",
std::any::type_name::<T>(),
std::any::TypeId::of::<T>(),
self.name
self.id
);
if let Some(this_ctx) = self.has_context() {
return Some(this_ctx);
@@ -207,10 +207,10 @@ impl Scope {
return None;
};
tracing::trace!(
"looking for context {} ({:?}) in {}",
"looking for context {} ({:?}) in {:?}",
std::any::type_name::<T>(),
std::any::TypeId::of::<T>(),
parent.name
parent.id
);
if let Some(shared) = parent.has_context() {
return Some(shared);
@@ -277,10 +277,10 @@ impl Scope {
/// ```
pub fn provide_context<T: 'static + Clone>(&self, value: T) -> T {
tracing::trace!(
"providing context {} ({:?}) in {}",
"providing context {} ({:?}) in {:?}",
std::any::type_name::<T>(),
std::any::TypeId::of::<T>(),
self.name
self.id
);
let mut contexts = self.shared_contexts.borrow_mut();