@pulse-editor/react-api 0.1.1-beta.81 → 0.1.1-beta.82

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/main.js CHANGED
@@ -5418,10 +5418,6 @@ function useActionEffect(params, deps, isExtReady = true) {
5418
5418
  if (isReady) {
5419
5419
  fetchRemoteOrigin();
5420
5420
  }
5421
- else {
5422
- // Set remote origin to local
5423
- setRemoteOrigin(window.location.origin);
5424
- }
5425
5421
  }, [isReady]);
5426
5422
  // Flush queued commands when isExtReady becomes true
5427
5423
  useEffect(() => {
@@ -5461,8 +5457,8 @@ function useActionEffect(params, deps, isExtReady = true) {
5461
5457
  }
5462
5458
  async function updateAction() {
5463
5459
  if (!remoteOrigin) {
5464
- console.error("Remote origin is not set yet");
5465
- throw new Error("Remote origin is not set yet");
5460
+ console.error("Remote origin is not set");
5461
+ return;
5466
5462
  }
5467
5463
  // Register or update action.
5468
5464
  // This will only pass signature info to the editor.
@@ -5470,7 +5466,11 @@ function useActionEffect(params, deps, isExtReady = true) {
5470
5466
  // so the execution happens inside the extension app.
5471
5467
  const { appId, version, actionInfo } = await getActionInfo(params.actionName);
5472
5468
  // Setup handler
5473
- const func = await loadAppAction(actionInfo.name, appId, remoteOrigin, version);
5469
+ const func = await loadAppActionFromMF(actionInfo.name, appId, remoteOrigin, version);
5470
+ if (!func) {
5471
+ console.error(`Failed to load action handler for ${actionInfo.name}`);
5472
+ throw new Error(`Failed to load action handler for ${actionInfo.name}`);
5473
+ }
5474
5474
  setActionHandler(() => func);
5475
5475
  await imc?.sendMessage(IMCMessageTypeEnum.EditorRegisterAction, {
5476
5476
  name: actionInfo.name,
@@ -5481,7 +5481,7 @@ function useActionEffect(params, deps, isExtReady = true) {
5481
5481
  // Update receiver
5482
5482
  imc?.updateReceiverHandlerMap(getReceiverHandlerMap(func));
5483
5483
  }
5484
- if (isExtReady && remoteOrigin) {
5484
+ if (isExtReady) {
5485
5485
  updateAction();
5486
5486
  }
5487
5487
  }, [
@@ -5569,7 +5569,7 @@ function useActionEffect(params, deps, isExtReady = true) {
5569
5569
  ]);
5570
5570
  return receiverHandlerMap;
5571
5571
  }
5572
- async function loadAppAction(func, appId, remoteOrigin, version) {
5572
+ async function loadAppActionFromMF(func, appId, remoteOrigin, version) {
5573
5573
  // here we assign the return value of the init() function, which can be used to do some more complex
5574
5574
  // things with the module federation runtime
5575
5575
  const instance = createInstance({