Workspace Academy · 2 / 5
Keep the selected customer
Connect list selection to shared state so later panels can follow it.
YOUR TASK
Make this happen
Upgrade the read-only table to a selectable record list with key customer.node.id and primary customer.node.name. Add workspace_state.selection named selectedCustomerId with an empty value, include it before the directory, and connect list select to selectedCustomerId.
Keep the working capabilities from the previous lesson and connect the new pieces to the same solution.
Check the complete solution, then inspect any unmet requirements.
This step starts with the earlier solution and one new challenge. Each lesson keeps its own draft.
Read the starter files
main.cococo
workspace_document "handoff" {
id = "customer-desk"
title = "Customer desk"
role = "Customer service"
domains = "customer"
children = [workspace_panel.directory]
}
directory.cococo
workspace_query_graphql "customers" {
component = "query-graphql"
source = "query CustomerDirectory { customers: listCustomers(first: 50) { edges { node { id name } } } }"
}
workspace_table_column "name" {
component = "table-column"
label = "Customer"
bindings = { value = "customer.node.name" }
}
workspace_record_table "customers" {
component = "record-table"
id = "customer-table"
bindings = { "for" = "customers.edges", "as" = "customer" }
children = [workspace_table_column.name]
}
workspace_panel "directory" {
component = "panel"
id = "directory"
title = "Customers"
children = [workspace_query_graphql.customers, workspace_record_table.customers]
}
Supplied supporting files
Reference: workspaces · getting-startedworkspaces · binding-stateworkspaces · queriesworkspaces · formsworkspaces · server-luaworkspaces · publication