From d3a752c820db1891df7f2c283dc4b0e9ef0536f8 Mon Sep 17 00:00:00 2001 From: SrGooglo Date: Mon, 25 Mar 2024 09:25:09 +0100 Subject: [PATCH] fix configs missing id --- .../src/components/InstallConfigAsk/index.jsx | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/src/renderer/src/components/InstallConfigAsk/index.jsx b/src/renderer/src/components/InstallConfigAsk/index.jsx index 24950b2..d714450 100644 --- a/src/renderer/src/components/InstallConfigAsk/index.jsx +++ b/src/renderer/src/components/InstallConfigAsk/index.jsx @@ -1,6 +1,4 @@ import React from "react" -import { Icons, Icon } from "components/Icons" - import * as antd from "antd" import PKGConfigItem from "../PackageConfigItem" @@ -11,12 +9,12 @@ const InstallConfigAsk = (props) => { const { manifest } = props const [values, setValues] = React.useState({ - ...manifest.storaged_configs, - ...Object.keys(manifest.configs).reduce((prev, key) => { - prev[key] = manifest.configs[key].default + ...Object.entries(manifest.configs).reduce((acc, [key, value]) => { + acc[key] = value.default - return prev - }, {}) + return acc + }, {}), + ...manifest.storaged_configs, }) const [currentStep, setCurrentStep] = React.useState(0) @@ -74,10 +72,16 @@ const InstallConfigAsk = (props) => { const steps = manifest.install_ask_configs.map((key, index) => { const config = manifest.configs[key] + if (!config.id) { + config.id = key + } + + const storagedConfig = manifest.storaged_configs?.[key] ?? manifest.configs[key].default + return }) @@ -85,6 +89,8 @@ const InstallConfigAsk = (props) => { return steps }, []) + console.log(values) + return