From 16ebc152a07923836a2574d2bd3e94e003c4ad76 Mon Sep 17 00:00:00 2001 From: shubham sharma Date: Fri, 6 Sep 2024 22:11:25 +0530 Subject: [PATCH] fix(hmr): subapp v1 (#2024) Co-authored-by: shubham2811 --- .../fix-hmr-subappV1_2024-09-06-16-32.json | 10 ++++++++++ packages/subapp-web/src/index.js | 13 +++++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 common/changes/subapp-web/fix-hmr-subappV1_2024-09-06-16-32.json diff --git a/common/changes/subapp-web/fix-hmr-subappV1_2024-09-06-16-32.json b/common/changes/subapp-web/fix-hmr-subappV1_2024-09-06-16-32.json new file mode 100644 index 000000000..8d32d78cc --- /dev/null +++ b/common/changes/subapp-web/fix-hmr-subappV1_2024-09-06-16-32.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "subapp-web", + "comment": "fix hmr error", + "type": "patch" + } + ], + "packageName": "subapp-web" +} \ No newline at end of file diff --git a/packages/subapp-web/src/index.js b/packages/subapp-web/src/index.js index 99bf703d4..823ef49fa 100644 --- a/packages/subapp-web/src/index.js +++ b/packages/subapp-web/src/index.js @@ -91,7 +91,7 @@ export function loadSubApp(info, renderStart, options) { subApp.start = (instance, options, info) => { instance = instance || subApp.preStart(instance, options, info); info = info || subApp.info; - if (instance && !instance.props) { + if (instance && !instance.props && options) { instance.props = options.props; } // if user provided a start function, then user is expected to @@ -187,7 +187,16 @@ export function isLoaded(name) { return Boolean(xarc.getSubApp(name)); } -export function lazyLoadSubApp({ name, id, timeout = 15000, onLoad, onError, fallback, ns, props }) { +export function lazyLoadSubApp({ + name, + id, + timeout = 15000, + onLoad, + onError, + fallback, + ns, + props +}) { // TODO: timeout and callback const lname = name.toLowerCase();