From 22a900b35e0de0440eecca9321b7174d223f91ef Mon Sep 17 00:00:00 2001 From: Keavon Chambers Date: Thu, 6 Mar 2025 22:56:09 -0800 Subject: [PATCH] Fix regresion from #2265 causing an extra default artboard to show up --- .../messages/portfolio/portfolio_message_handler.rs | 4 +++- node-graph/gcore/src/instances.rs | 10 ++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/editor/src/messages/portfolio/portfolio_message_handler.rs b/editor/src/messages/portfolio/portfolio_message_handler.rs index b8a2cc7aa..ee8b8c483 100644 --- a/editor/src/messages/portfolio/portfolio_message_handler.rs +++ b/editor/src/messages/portfolio/portfolio_message_handler.rs @@ -595,7 +595,9 @@ impl MessageHandler> for PortfolioMes }; let Some(ref reference) = node_metadata.persistent_metadata.reference.clone() else { - log::error!("could not get reference in deserialize_document"); + // TODO: Investigate if this should be an expected case, because currently it runs hundreds of times normally. + // TODO: Either delete the commented out error below if this is normal, or fix the underlying issue if this is not expected. + // log::error!("could not get reference in deserialize_document"); continue; }; diff --git a/node-graph/gcore/src/instances.rs b/node-graph/gcore/src/instances.rs index 6bd232cc4..bb7f0f475 100644 --- a/node-graph/gcore/src/instances.rs +++ b/node-graph/gcore/src/instances.rs @@ -118,9 +118,15 @@ impl Instances { } } -impl Default for Instances { +impl Default for Instances { fn default() -> Self { - Self::new(T::default()) + use core::any::TypeId; + if TypeId::of::() == TypeId::of::() { + // TODO: Remove the 'static trait bound when this special casing is removed by making all types return empty + Self::empty() + } else { + Self::new(T::default()) + } } }