Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -559,6 +559,22 @@ function deferred<T>() {
return { promise, resolve: resolvePromise, reject: rejectPromise };
}

test('connection detail keys its default action apart from the detail it sits beside', async (context) => {
const errorLog = context.mock.method(console, 'error', () => undefined);
const harness = installRenderer();
const connection = relayConnection();
const bridge = connectionDetailBridge({
hasSecret: async () => true,
getSnapshot: async () => ({ connections: [connection], defaultConnection: 'relay-a', chatModelChoices: [] }),
});
await harness.render('zh-CN', providersPanel(bridge, connection.slug));
assert.ok(harness.document.querySelector('[data-maka-contract="connection-detail"]'));
const duplicateKeys = errorLog.mock.calls
.map((call) => call.arguments.map(String).join(' '))
.filter((message) => message.includes('same key'));
assert.deepEqual(duplicateKeys, []);
});

test('setting a default with one enabled model commits directly', async () => {
const harness = installRenderer();
const connection = { ...relayConnection(), defaultModel: '' };
Expand Down
4 changes: 3 additions & 1 deletion apps/desktop/src/renderer/settings/providers-panel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,9 @@ function ProvidersPanelContent({ bridge, apiKeyOnboardingBridge, initialPage = '
// swaps", and it draws no ring.
(<VStack gap={5} tabIndex={-1} role="region" aria-labelledby={detailTitleId} className="settingsRouteLevel" data-maka-contract="connection-detail">
<ConnectionDefaultAction
key={selected.connectionId}
/* Both children of this level remount per connection; the prefix
keeps this key apart from its ConnectionDetail sibling's. */
key={`default-action:${selected.connectionId}`}
connection={selected}
bridge={bridge}
onChanged={async () => { await reload(); }}
Expand Down