1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

Fix not being able to add custom helm repos (#6692)

* Add missing safety checks in unit tests for structured clone issues

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Fix not being able to add custom helm repos

Signed-off-by: Sebastian Malton <sebastian@malton.name>

Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
Sebastian Malton 2022-12-02 04:53:00 -08:00 committed by GitHub
parent 33e6771da3
commit ad31b73264
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 1 deletions

View File

@ -23,6 +23,7 @@ import maximalCustomHelmRepoOptionsAreShownInjectable from "./maximal-custom-hel
import { SubTitle } from "../../../../../../renderer/components/layout/sub-title";
import { Checkbox } from "../../../../../../renderer/components/checkbox";
import { HelmFileInput } from "./helm-file-input/helm-file-input";
import { toJS } from "../../../../../../common/utils";
interface Dependencies {
helmRepo: HelmRepo;
@ -36,7 +37,7 @@ const NonInjectedActivationOfCustomHelmRepositoryDialogContent = observer(({ hel
<WizardStep
contentClass="flow column"
nextLabel="Add"
next={() => submitCustomRepository(helmRepo)}
next={() => submitCustomRepository(toJS(helmRepo))}
testIdForNext="custom-helm-repository-submit-button"
testIdForPrev="custom-helm-repository-cancel-button"
>

View File

@ -3,6 +3,7 @@
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
import type { DiContainer } from "@ogre-tools/injectable";
import { deserialize, serialize } from "v8";
import type { MessageChannel, MessageChannelListener } from "../../common/utils/channel/message-channel-listener-injection-token";
import enlistMessageChannelListenerInjectableInMain from "../../main/utils/channel/channel-listeners/enlist-message-channel-listener.injectable";
import { getOrInsertSet } from "../../renderer/utils";
@ -40,6 +41,12 @@ export const overrideMessagingFromWindowToMain = (mainDi: DiContainer) => {
);
}
try {
message = deserialize(serialize(message));
} catch (error) {
throw new Error(`Tried to send a message to channel "${channelId}" that is not compatible with StructuredClone: ${error}`);
}
listeners.forEach((listener) => listener.handler(message));
});
};

View File

@ -3,6 +3,7 @@
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
import type { DiContainer } from "@ogre-tools/injectable";
import { deserialize, serialize } from "v8";
import type { RequestChannel } from "../../common/utils/channel/request-channel-listener-injection-token";
import type { RequestFromChannel } from "../../common/utils/channel/request-from-channel-injection-token";
import enlistRequestChannelListenerInjectableInMain from "../../main/utils/channel/channel-listeners/enlist-request-channel-listener.injectable";
@ -46,6 +47,12 @@ export const overrideRequestingFromWindowToMain = (mainDi: DiContainer) => {
);
}
try {
request = deserialize(serialize(request));
} catch (error) {
throw new Error(`Tried to request from channel "${channel.id}" with data that is not compatible with StructuredClone: ${error}`);
}
return requestListener.handler(request);
}) as RequestFromChannel,
);