Skip to content

Commit 915b598

Browse files
committed
hotfix remote config parsing error
1 parent 7094aea commit 915b598

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

web/components/modals/extension-marketplace-modal.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { getRemoteMFVersion } from "@/lib/module-federation/version";
22
import { fetchAPI } from "@/lib/pulse-editor-website/backend";
3-
import { ExtensionApp, AppMetaData, TabItem } from "@/lib/types";
3+
import { AppMetaData, ExtensionApp, TabItem } from "@/lib/types";
44
import { useContext, useEffect, useState } from "react";
55
import useSWR from "swr";
66
import ExtensionGallery from "../extension/extension-gallery";
@@ -15,9 +15,9 @@ export default function ExtensionMarketplaceModal({
1515
isOpen: boolean;
1616
setIsOpen: (open: boolean) => void;
1717
}) {
18-
const [installedExtensions, setInstalledExtensions] = useState<ExtensionApp[]>(
19-
[],
20-
);
18+
const [installedExtensions, setInstalledExtensions] = useState<
19+
ExtensionApp[]
20+
>([]);
2121

2222
const extensionCategories: TabItem[] = [
2323
{

web/lib/module-federation/remote.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export function getRemoteServerBaseURL(
2929
return `${remoteOrigin}/${id}/${version}/server`;
3030
}
3131

32-
export async function getRemoteManifest(
32+
export async function getRemoteClientManifest(
3333
remoteOrigin: string,
3434
id: string,
3535
version: string,
@@ -45,7 +45,7 @@ export async function getRemoteManifest(
4545
return mfManifest;
4646
}
4747

48-
export function getRemoteConfig(
48+
export function getRemoteClientConfig(
4949
remoteOrigin: string,
5050
id: string,
5151
version: string,

web/lib/module-federation/version.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { AppConfig } from "@pulse-editor/shared-utils";
22
import { satisfies } from "semver";
33
import mfRuntime from "../../../node_modules/@module-federation/runtime/package.json";
44
import packageJson from "../../package.json";
5-
import { getRemoteConfig, getRemoteManifest } from "./remote";
5+
import { getRemoteClientConfig, getRemoteClientManifest } from "./remote";
66

77
export async function getHostMFVersion(): Promise<string> {
88
return mfRuntime.version;
@@ -13,9 +13,9 @@ export async function getRemoteMFVersion(
1313
id: string,
1414
version: string,
1515
): Promise<string> {
16-
const mfManifest = await getRemoteManifest(remoteOrigin, id, version);
16+
const mfManifest = await getRemoteClientManifest(remoteOrigin, id, version);
1717
if (!mfManifest || !mfManifest.metaData) {
18-
throw new Error("Remote MF manifest or metaData is undefined");
18+
return "unknown";
1919
}
2020
return mfManifest.metaData.pluginVersion;
2121
}
@@ -30,13 +30,13 @@ export async function getRemoteLibVersion(
3030
id: string,
3131
version: string,
3232
): Promise<string> {
33-
const pulseConfig: AppConfig = await getRemoteConfig(
33+
const pulseConfig: AppConfig = await getRemoteClientConfig(
3434
remoteOrigin,
3535
id,
3636
version,
3737
);
38-
if (!pulseConfig) {
39-
throw new Error("Remote pulse.config.json undefined");
38+
if (!pulseConfig || !pulseConfig.libVersion) {
39+
return "unknown";
4040
}
4141
const libVersion = pulseConfig.libVersion;
4242
return libVersion;

0 commit comments

Comments
 (0)