0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2024-12-16 20:26:19 -05:00

fix(console): fix empty string update of connector config form (#6626)

Revert "fix(console): fix passwordless connector tester send failed bug (#6268)"

This reverts commit 6963192ac5.
This commit is contained in:
wangsijie 2024-09-24 13:48:35 +08:00 committed by GitHub
parent b73728bbe5
commit f8fd52b2f8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 4 additions and 18 deletions

View file

@ -31,13 +31,9 @@ const useJsonStringConfigParser = () => {
export const useConnectorFormConfigParser = () => {
const parseJsonConfig = useJsonStringConfigParser();
return (
data: ConnectorFormType,
formItems: ConnectorResponse['formItems'],
skipFalsyValuesRemoval = false
) => {
return (data: ConnectorFormType, formItems: ConnectorResponse['formItems']) => {
return formItems
? parseFormConfig(data.formConfig, formItems, skipFalsyValuesRemoval)
? parseFormConfig(data.formConfig, formItems)
: parseJsonConfig(data.jsonConfig);
};
};

View file

@ -68,11 +68,7 @@ function ConnectorContent({ isDeleted, connectorData, onConnectorUpdated }: Prop
const { syncProfile, name, logo, logoDark, target, rawConfig } = data;
// Apply the raw config first to avoid losing data updated from other forms that are not
// included in the form items.
// Explicitly SKIP falsy values removal logic (the last argument of `configParser()` method) for social connectors.
const config = removeFalsyValues({
...rawConfig,
...configParser(data, formItems, isSocialConnector),
});
const config = removeFalsyValues({ ...rawConfig, ...configParser(data, formItems) });
const payload = isSocialConnector
? {

View file

@ -22,17 +22,11 @@ const initFormData = (formItems: ConnectorConfigFormItem[], config?: Record<stri
export const parseFormConfig = (
config: Record<string, unknown>,
formItems: ConnectorConfigFormItem[],
skipFalsyValuesRemoval = false
formItems: ConnectorConfigFormItem[]
) => {
return Object.fromEntries(
Object.entries(config)
.map(([key, value]) => {
// Filter out empty input
if (!skipFalsyValuesRemoval && value === '') {
return null;
}
const formItem = formItems.find((item) => item.key === key);
if (!formItem) {