style(provider): improve type annotation formatting in EditProviderDialog
This commit is contained in:
@@ -35,7 +35,10 @@ export function EditProviderDialog({
|
|||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
// 默认使用传入的 provider.settingsConfig,若当前编辑对象是“当前生效供应商”,则尝试读取实时配置替换初始值
|
// 默认使用传入的 provider.settingsConfig,若当前编辑对象是“当前生效供应商”,则尝试读取实时配置替换初始值
|
||||||
const [liveSettings, setLiveSettings] = useState<Record<string, unknown> | null>(null);
|
const [liveSettings, setLiveSettings] = useState<Record<
|
||||||
|
string,
|
||||||
|
unknown
|
||||||
|
> | null>(null);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
let cancelled = false;
|
let cancelled = false;
|
||||||
@@ -48,7 +51,9 @@ export function EditProviderDialog({
|
|||||||
const currentId = await providersApi.getCurrent(appId);
|
const currentId = await providersApi.getCurrent(appId);
|
||||||
if (currentId && provider.id === currentId) {
|
if (currentId && provider.id === currentId) {
|
||||||
try {
|
try {
|
||||||
const live = (await vscodeApi.getLiveProviderSettings(appId)) as Record<string, unknown>;
|
const live = (await vscodeApi.getLiveProviderSettings(
|
||||||
|
appId,
|
||||||
|
)) as Record<string, unknown>;
|
||||||
if (!cancelled && live && typeof live === "object") {
|
if (!cancelled && live && typeof live === "object") {
|
||||||
setLiveSettings(live);
|
setLiveSettings(live);
|
||||||
}
|
}
|
||||||
@@ -70,7 +75,10 @@ export function EditProviderDialog({
|
|||||||
}, [open, provider, appId]);
|
}, [open, provider, appId]);
|
||||||
|
|
||||||
const initialSettingsConfig = useMemo(() => {
|
const initialSettingsConfig = useMemo(() => {
|
||||||
return (liveSettings ?? provider?.settingsConfig ?? {}) as Record<string, unknown>;
|
return (liveSettings ?? provider?.settingsConfig ?? {}) as Record<
|
||||||
|
string,
|
||||||
|
unknown
|
||||||
|
>;
|
||||||
}, [liveSettings, provider]);
|
}, [liveSettings, provider]);
|
||||||
|
|
||||||
const handleSubmit = useCallback(
|
const handleSubmit = useCallback(
|
||||||
|
|||||||
Reference in New Issue
Block a user