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:
parent
33e6771da3
commit
ad31b73264
@ -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"
|
||||
>
|
||||
|
||||
@ -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));
|
||||
});
|
||||
};
|
||||
|
||||
@ -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,
|
||||
);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user