Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: list of flows should display and be sorted by most recent operations, not flows.updated_at #3241

Merged
merged 2 commits into from
Jun 5, 2024

Conversation

jessicamcinchak
Copy link
Member

@jessicamcinchak jessicamcinchak commented Jun 4, 2024

Changes:
August mentioned that it's really disorienting that all the flows within a team now show the same "Edited 5 days ago" timestamp - this is because this message was referencing flows.updated_at which changed when flows.status merged and is updated, whereas we really think about "edits" to a flow coming from the associated operations.

Now updated to display based on operations, sharing the same formatting as in-graph view of "Last edited..." too. This means that both the list & graph timestamps will now match (previously they didn't 🙈), and that the list timestamps now ignore bulk flow migrations or non-data changes like renaming, toggling status, etc.

See thread: https://opensystemslab.slack.com/archives/C5Q59R3HB/p1717571853477949

Testing:
Click into a flow, edit the graph data, click back out to the list of services within the team and confirm it's at the top of the list with a correct "Last edited {at} by {user}" message.

Note that real operations are not synced from production to other environments (staging, local, pizza), so you won't see a first and last name associated with the timestamp on the pizza until new edits are made. Only production has a full history!


export const formatLastPublishMessage = (date: string, user: string): string =>
`Last published ${formatLastEditDate(date)} ago by ${user}`;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just a small tidy up so that all of the helper methods that rely on formatDistanceToNow() are co-located in the same file

@jessicamcinchak jessicamcinchak marked this pull request as ready for review June 4, 2024 10:18
@jessicamcinchak jessicamcinchak requested a review from a team June 4, 2024 10:18
Copy link

github-actions bot commented Jun 4, 2024

Removed vultr server and associated DNS entries

b.operations[0]["createdAt"].localeCompare(
a.operations[0]["createdAt"],
),
);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previously, we sorted directly via the GraphQL query like flows (order_by: { updated_at: desc }) {...} - but we want to sort via operations, not flows, so now we're doing a custom sort here !

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: possibly good use for ToSorted() to copy and sort array with one method

@jessicamcinchak jessicamcinchak changed the title fix: list of flows should show last edited based on operations, not flows.updated_at fix: list of flows should display and be sorted by most recent operations, not flows.updated_at Jun 4, 2024
Copy link
Contributor

@RODO94 RODO94 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lovely code! Added "nit" comment

b.operations[0]["createdAt"].localeCompare(
a.operations[0]["createdAt"],
),
);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: possibly good use for ToSorted() to copy and sort array with one method

@jessicamcinchak jessicamcinchak merged commit 0329997 into main Jun 5, 2024
12 checks passed
@jessicamcinchak jessicamcinchak deleted the jess/flow-last-edit branch June 5, 2024 15:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants