Skip to content

Commit

Permalink
fix(staging): infinite loading spinner and publish button (#1246)
Browse files Browse the repository at this point in the history
* fix: update mutation to get latest published flow

Previously we would rely on the id but this breaks publishing on staging now that we're sync'ing data in from production.

* fix: sharedb error when syncing with production
  • Loading branch information
gunar authored Nov 2, 2022
1 parent bc272e1 commit 3a2b262
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion api.planx.uk/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const getMostRecentPublishedFlow = async (id: string) => {
`
query GetMostRecentPublishedFlow($id: uuid!) {
flows_by_pk(id: $id) {
published_flows(limit: 1, order_by: { id: desc }) {
published_flows(limit: 1, order_by: { created_at: desc }) {
data
}
}
Expand Down
8 changes: 6 additions & 2 deletions scripts/seed-database/upsert-production-flows.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ const LOCAL_GRAPHQL_ADMIN_SECRET = process.env.HASURA_GRAPHQL_ADMIN_SECRET;
slug
team_id
settings
version
created_at
updated_at
}
Expand All @@ -72,7 +71,12 @@ const LOCAL_GRAPHQL_ADMIN_SECRET = process.env.HASURA_GRAPHQL_ADMIN_SECRET;

await localClient.request(
insertFlowsMutation,
{ flows: productionFlows || [], }
{
flows: productionFlows?.map(flow => ({
...flow,
version: 1,
})) || [],
}
);

console.log('Inserting Operations...');
Expand Down

0 comments on commit 3a2b262

Please sign in to comment.