@weaverse/next 0.1.0-alpha.12 → 0.1.0-alpha.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -701,6 +701,18 @@ function registerRuntime(runtime) {
701
701
  runtimeWindow.__weaverses[runtime.pageId] = runtime;
702
702
  runtimeWindow.__weaverse = runtime;
703
703
  }
704
+ function rebindPageItemsToRuntime(runtime) {
705
+ let items = runtime.data?.items;
706
+ if (!items) {
707
+ return;
708
+ }
709
+ for (let { id } of items) {
710
+ let instance = runtime.itemInstances.get(id);
711
+ if (instance && instance.weaverse !== runtime) {
712
+ instance.weaverse = runtime;
713
+ }
714
+ }
715
+ }
704
716
  var WeaverseNextRuntime = class extends react.Weaverse {
705
717
  pageId;
706
718
  internal;
@@ -924,6 +936,7 @@ function createWeaverseNextRuntime(config) {
924
936
  () => new WeaverseNextRuntime(config)
925
937
  );
926
938
  runtime.pendingItemUpdates = refreshedItems;
939
+ rebindPageItemsToRuntime(runtime);
927
940
  runtime.__weaverseNextRequestKey = requestKey;
928
941
  runtime.__weaverseNextLatestData = page;
929
942
  registerRuntime(runtime);