diff --git a/specifyweb/frontend/js_src/lib/components/FormEditor/viewSpec.ts b/specifyweb/frontend/js_src/lib/components/FormEditor/viewSpec.ts index dae49c3a210..55d488e32af 100644 --- a/specifyweb/frontend/js_src/lib/components/FormEditor/viewSpec.ts +++ b/specifyweb/frontend/js_src/lib/components/FormEditor/viewSpec.ts @@ -413,12 +413,14 @@ const subViewSpec = ( syncer( (raw: string) => { const cellName = cell.rest.node.attributes.name; - const cellRelationship = table?.fields - .filter((field) => field.isRelationship) - .find((table) => table.name === cellName) as - | Relationship - | undefined; - const cellRelatedTableName = cellRelationship?.relatedTable.name; + const cellRelationship = + typeof cellName === 'string' + ? syncers.field(table?.name).serializer(cellName)?.at(-1) + : undefined; + const cellRelatedTableName = + cellRelationship?.isRelationship === true + ? cellRelationship.relatedTable.name + : undefined; const parsed = toLargeSortConfig(raw); const fieldNames = syncers .field(cellRelatedTableName) @@ -781,11 +783,8 @@ const textSpec = f.store(() => // eslint-disable-next-line @typescript-eslint/explicit-function-return-type const textAreaSpec = ( _field: SpecToJson>, - { - rawType, - }: { - readonly rawType: string; - } + _: unknown, + rawType: string ) => createXmlSpec({ rows: pipe( diff --git a/specifyweb/frontend/js_src/lib/components/Syncer/syncers.ts b/specifyweb/frontend/js_src/lib/components/Syncer/syncers.ts index ca80ba6da8a..aaa772ecc16 100644 --- a/specifyweb/frontend/js_src/lib/components/Syncer/syncers.ts +++ b/specifyweb/frontend/js_src/lib/components/Syncer/syncers.ts @@ -599,7 +599,8 @@ export const syncers = { MAPPER extends { readonly [KEY in TYPE_MAPPER[keyof TYPE_MAPPER] | 'Unknown']: ( input: IN, - extra: EXTRA & { readonly rawType: keyof TYPE_MAPPER } + extra: EXTRA, + rawType: keyof TYPE_MAPPER ) => BaseSpec; }, MAPPED extends { @@ -658,7 +659,7 @@ export const syncers = { ]) as TYPE_MAPPER[keyof TYPE_MAPPER]) ?? ('Unknown' as const); const spec = mapper[type] ?? mapper.Unknown; const { serializer } = syncers.object( - spec(cell, { ...extraPayload, rawType }) + spec(cell, extraPayload, rawType) ); return { @@ -692,7 +693,7 @@ export const syncers = { )?.[0] ?? rawType; const spec = mapper[definition.type] ?? mapper.Unknown; const { deserializer } = syncers.object( - spec(cell as unknown as IN, { ...extraPayload, rawType }) + spec(cell as unknown as IN, extraPayload, rawType) ); const node = deserializer(definition); const rawNode: NodeWithContext = {