Skip to content

Commit 2a44614

Browse files
committed
chore(interfaces): use the shared submit-label default and guard a clipboard call
The copilot tool re-stated 'Submit' as a literal, which is what DEFAULT_FORM_SUBMIT_LABEL exists to prevent — and its test asserted the same literal, so the two could drift from the server default while staying green. Both now read the constant. Also voids the interfaces-list clipboard write: denied permission rejects, and every other copy call site in the app already handles that.
1 parent c2317eb commit 2a44614

3 files changed

Lines changed: 8 additions & 5 deletions

File tree

apps/sim/app/workspace/[workspaceId]/interfaces/interfaces.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,9 @@ export function Interfaces() {
311311

312312
function handleCopyActiveId(): void {
313313
if (activeInterface) {
314-
navigator.clipboard.writeText(activeInterface.id)
314+
// Denied clipboard permission rejects; `void` keeps that from surfacing as
315+
// an unhandled rejection, matching every other copy call site in the app.
316+
void navigator.clipboard.writeText(activeInterface.id)
315317
}
316318
}
317319

apps/sim/lib/copilot/tools/server/interfaces/user-interface.test.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
import { beforeEach, describe, expect, it, vi } from 'vitest'
66
import type { ServerToolContext } from '@/lib/copilot/tools/server/base-tool'
7+
import { DEFAULT_FORM_SUBMIT_LABEL } from '@/lib/interfaces/constants'
78
import type { InterfaceDefinition, InterfaceModule } from '@/lib/interfaces/types'
89

910
const {
@@ -602,7 +603,7 @@ describe('userInterfaceServerTool', () => {
602603
placement: { row: 1, col: 0, rowSpan: 1, colSpan: 1 },
603604
config: {
604605
workflowId: 'wf_1',
605-
submitLabel: 'Submit',
606+
submitLabel: DEFAULT_FORM_SUBMIT_LABEL,
606607
fields: [
607608
{
608609
id: 'generated-id',
@@ -637,7 +638,7 @@ describe('userInterfaceServerTool', () => {
637638
expect(mockAddModule).toHaveBeenCalledWith(
638639
'int_1',
639640
expect.objectContaining({
640-
config: expect.objectContaining({ submitLabel: 'Submit' }),
641+
config: expect.objectContaining({ submitLabel: DEFAULT_FORM_SUBMIT_LABEL }),
641642
})
642643
)
643644
})

apps/sim/lib/copilot/tools/server/interfaces/user-interface.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ import {
6060
* routing them separately keeps grid arithmetic real in tests that stub the
6161
* service surface.
6262
*/
63-
import { DEFAULT_MODULE_SPAN } from '@/lib/interfaces/constants'
63+
import { DEFAULT_FORM_SUBMIT_LABEL, DEFAULT_MODULE_SPAN } from '@/lib/interfaces/constants'
6464
import { overlappingModules } from '@/lib/interfaces/geometry'
6565
import { getUserEntityPermissions } from '@/lib/workspaces/permissions/utils'
6666

@@ -347,7 +347,7 @@ function normalizeFormConfig(raw: unknown): FormModuleConfig {
347347
}
348348
return {
349349
workflowId: nullableId(config, 'workflowId'),
350-
submitLabel: configString(config, 'submitLabel', 'Submit'),
350+
submitLabel: configString(config, 'submitLabel', DEFAULT_FORM_SUBMIT_LABEL),
351351
fields: Array.isArray(fields) ? fields.map(readFormField) : [],
352352
}
353353
}

0 commit comments

Comments
 (0)