importCottonValuesimportSwiftUI/// A search or kept list opens a record linked from each result, retaining/// its result id as the conversation anchor when the target draws this table.structTableLinkedListRoute: View {let table: Stringlet link: Stringvar filter: [String: RecordValue] = [:] @Environment(\.tableDefinitions) privatevar definitionsvar body: someView {iflet definition = definitions[table] {// The list the linked table declares for these records, so a route to// it reads as that list does ("Kept messages", its own empty words).let declared = definition.column(link)?.linkTo.flatMap { definitions[$0] }?.related? .first { $0.table == table && $0.column == nil && ($0.filter ?? [:]) == filter && $0.open == link }RelatedRecordList( definition: definition, relation: declared ?? RelatedRecords( label: definition.plural, table: table, column: nil, filter: filter, new: nil, open: link), record: TableRecord(id: "", values: [:])) } }}