[COLLAB-CON-1]: getFlowConnections query#1337
[COLLAB-CON-1]: getFlowConnections query#1337kevinkim-ogp wants to merge 2 commits intodevelop-v2from
Conversation
How to use the Graphite Merge QueueAdd the label lfg to this PR to add it to the merge queue. You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
edbf3a8 to
fc3338d
Compare
|
bugbot run |
There was a problem hiding this comment.
This PR is being reviewed by Cursor Bugbot
Details
You are on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle.
To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.
|
|
||
| const filteredFlowConnections = rawFlowConnections.filter( | ||
| (flowConnection) => flowConnection.connection || flowConnection.table, | ||
| ) |
There was a problem hiding this comment.
Bug: Filter doesn't match connectionType, causing undefined connectionName
The filter keeps records where connection OR table exists, but the subsequent logic uses connectionType to determine which relation to read from. If connectionType is 'table' but only connection exists (or vice versa), the record passes the filter but connectionName becomes undefined. The GraphQL schema declares connectionName: String! as non-nullable, so returning undefined will cause a runtime error. The filter needs to verify the correct relation exists based on connectionType.
Additional Locations (1)
fc3338d to
611b51a
Compare
611b51a to
dacae29
Compare
pregnantboy
left a comment
There was a problem hiding this comment.
Tested and works. Only main thing to change is the permission check for flow not correct. and the later filters for connectionType can be better refactored
| const flowConnections = await Promise.all( | ||
| filteredFlowConnections.map(async (flowConnection) => { | ||
| let connectionName = flowConnection?.connection?.formattedData?.screenName | ||
| if (flowConnection.connectionType === 'table') { |
There was a problem hiding this comment.
| if (flowConnection.connectionType === 'table') { | |
| if (flowConnection.connectionType === 'table' && flowConnection.table) { |
| if (flowConnection.connectionType === 'table') { | ||
| appKey = 'tiles' | ||
| } | ||
| const app = apps.find((app: IApp) => app.key === appKey) |
There was a problem hiding this comment.
| const app = apps.find((app: IApp) => app.key === appKey) | |
| const app = apps.find((app: IApp) => app.key === (flowConnection.connectionType === 'table' ? | |
| 'tiles' : appKey)) |
dacae29 to
7cafb8e
Compare
7cafb8e to
b8d7229
Compare
b8d7229 to
d8fab6f
Compare
d8fab6f to
ab163df
Compare
ab163df to
65d7019
Compare
| const appKey = flowConnection.connection?.key | ||
| const app = apps.find( | ||
| (app: IApp) => | ||
| app.key === | ||
| (flowConnection.connectionType === 'table' ? 'tiles' : appKey), | ||
| ) | ||
|
|
||
| if (!app) { | ||
| throw new Error(`App not found for key: ${appKey}`) | ||
| } |
There was a problem hiding this comment.
The error message will be misleading for table connections. When connectionType === 'table', appKey is undefined (since flowConnection.connection doesn't exist), but the actual key being searched for is 'tiles'. The error will say "App not found for key: undefined" instead of "App not found for key: tiles".
Fix:
const appKey = flowConnection.connectionType === 'table'
? 'tiles'
: flowConnection.connection?.key
const app = apps.find((app: IApp) => app.key === appKey)
if (!app) {
throw new Error(`App not found for key: ${appKey}`)
}Spotted by Graphite
Is this helpful? React 👍 or 👎 to let us know.

TL;DR
Added a new
getFlowConnectionsquery to fetch shared connection.What changed?
getFlowConnectionsthat returns connections associated with a specific flowSharedFlowConnectionto represent flow connections in the schemaHow to test?
Note
Introduces
getFlowConnectionsto return a flow’s shared connections (apps and tables) with app metadata and contributor info, updating schema/resolvers and adding tests.getFlowConnections(flowId: String!)returning[SharedFlowConnection!]!.SharedFlowConnectionwithflowId,connectionId,connectionType,appName,appIconUrl,addedBy,connectionName.queries/get-flow-connections.ts:currentUser.withAccessibleFlows(requiredRole: 'editor').FlowConnectionswithconnection,table, anduserrelations.App.findAll(); usestilesfor table connections.connectionortable.query-resolvers.tsand schema.user?: Userproperty toFlowConnections.__tests__/queries/get-flow-connections.test.ts.Written by Cursor Bugbot for commit fc3338d. This will update automatically on new commits. Configure here.