Skip to content

Conversation

@mindspank
Copy link
Contributor

Iterates over components to find the latest underlying refresh time of a model.

Checklist:

  • Covered by tests
  • Ran it and it works as intended
  • Reviewed the diff before requesting a review
  • Checked for unhandled edge cases
  • Linked the issues it closes
  • Checked if the docs need to be updated
  • Intend to cherry-pick into the release branch
  • I'm proud of this work!

@mindspank mindspank requested a review from ericpgreen2 May 9, 2025 10:40
Comment on lines +92 to +100
// Find the max refresh time of all the resources that are referenced by the components in the dashboard
const maxRefresh = dashboard.meta.refs
.map((r) => allResources.get(`${r?.kind}_${r?.name}`))
.filter((c) => c.meta.refs.length) // filter out resources that don't have refs such as markdown and image
.map((m) =>
allResources.get(`${m.meta.refs[0].kind}_${m.meta.refs[0].name}`),
)
.map((m) => m.metricsView.state?.modelRefreshedOn)
.reduce((max, c) => (c > max ? c : max));
Copy link
Contributor

Choose a reason for hiding this comment

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

This chaining feels a bit clever. It might be easier to read if you broke it up (kind of like the previous code)?

@mindspank mindspank merged commit e0c3256 into main May 30, 2025
8 checks passed
@mindspank mindspank deleted the fix/canvas-refresh branch May 30, 2025 19:30
mindspank added a commit that referenced this pull request May 30, 2025
* fix: find max refresh for components

* nit: comments

* fix: format
grahamplata pushed a commit that referenced this pull request Jun 4, 2025
* fix: find max refresh for components

* nit: comments

* fix: format
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.

3 participants