Fix relative execution time not updating in notebook cell footer #11570
+30
−6
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Addresses #11573
This PR fixes the relative execution time display (e.g., "2 mins ago") in the notebook cell footer not updating over time.
The
lastRunEndTimevalue is set once after cell execution completes and never changes afterward. Since the cell footer component only re-rendered when this value changed, the relative time display would remain stuck at "Just now" indefinitely until another user action caused the cells in the notebook to re-render (e.g., adding a new cell to the notebook).This PR adds a 60-second interval that forces the component to re-render, recalculating the relative time from
getRelativeTime(). To prevent unnecessary re-renders, the interval only triggers a re-render when the cell is visible in the viewport, using the existingcell.isInViewport()method.I also removes the seconds-level granularity from
getRelativeTime()since the update only occurs on a minute level.Screenshot
Note: I edited the video to skip the 1 minute of waiting while we wait for the cell footer to update
exeuction_time.mp4
Release Notes
New Features
Bug Fixes
QA Notes
To verify execution time is being updated:
print("hello"))Just now1 min ago, then2 mins ago, etc.To verify only visible cells are re-rendering the footer:
@:positron-notebooks