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();