Skip to content

Commit e9817a8

Browse files
feat: improve plugin store authentication handling in useVisualConfig
1 parent e5fd4af commit e9817a8

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

src/hooks/useVisualConfig.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1205,6 +1205,7 @@ export function useVisualConfig() {
12051205
doc.contents = doc.createNode({}) as unknown as typeof doc.contents;
12061206
}
12071207
const values = visualValues;
1208+
const shouldWritePluginStoreAuth = dirtyFields.has('pluginStoreAuth');
12081209

12091210
setStringInDoc(doc, ['host'], values.host);
12101211
setIntFromStringInDoc(doc, ['port'], values.port);
@@ -1266,7 +1267,7 @@ export function useVisualConfig() {
12661267
docHas(doc, ['plugins']) ||
12671268
values.pluginsEnabled ||
12681269
values.pluginStoreSources.length > 0 ||
1269-
values.pluginStoreAuth.length > 0 ||
1270+
shouldWritePluginStoreAuth ||
12701271
shouldWriteManagedField(doc, ['plugins', 'enabled'], dirtyFields, 'pluginsEnabled') ||
12711272
shouldWriteManagedField(
12721273
doc,
@@ -1289,10 +1290,7 @@ export function useVisualConfig() {
12891290
) {
12901291
setStringListInDoc(doc, ['plugins', 'store-sources'], values.pluginStoreSources);
12911292
}
1292-
if (
1293-
values.pluginStoreAuth.length > 0 ||
1294-
shouldWriteManagedField(doc, ['plugins', 'store-auth'], dirtyFields, 'pluginStoreAuth')
1295-
) {
1293+
if (shouldWritePluginStoreAuth) {
12961294
const storeAuth = serializePluginStoreAuthForYaml(values.pluginStoreAuth);
12971295
if (storeAuth.length > 0) {
12981296
doc.setIn(['plugins', 'store-auth'], storeAuth);

0 commit comments

Comments
 (0)