Skip to content

Conversation

@sfc-gh-lwilby
Copy link
Collaborator

@sfc-gh-lwilby sfc-gh-lwilby commented Oct 24, 2024

Describe your changes

The running man animation appears while the script re-run is being performed and for re-runs that complete quickly it introduces a flicker and creates the perception of a longer wait. This PR introduces a delay when showing the running man animation.

GitHub Issue Link (if applicable)

Testing Plan

  • Unit Tests (one added to confirm not visible without delay, plus coverage by existing running man tests)
  • Manual testing by PM and Engineer to confirm expected visual behaviour.

Contribution License Agreement

By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.

@sfc-gh-lwilby sfc-gh-lwilby changed the title Add a delay before displaying the running man icon. [WIP] Add a delay before displaying the running man icon. Oct 24, 2024
@sfc-gh-lwilby sfc-gh-lwilby force-pushed the feature-running-man-delay branch from fff2c25 to f906c26 Compare October 24, 2024 23:33
@sfc-gh-lwilby sfc-gh-lwilby marked this pull request as ready for review October 28, 2024 18:01
@sfc-gh-lwilby sfc-gh-lwilby changed the title [WIP] Add a delay before displaying the running man icon. Add a delay before displaying the running man icon. Oct 28, 2024
@sfc-gh-lwilby sfc-gh-lwilby added security-assessment-completed Security assessment has been completed for PR change:feature PR contains new feature or enhancement implementation impact:users PR changes affect end users labels Oct 28, 2024
@sfc-gh-lwilby sfc-gh-lwilby force-pushed the feature-running-man-delay branch from e836093 to 5e7a208 Compare October 28, 2024 18:15
Copy link
Collaborator

Choose a reason for hiding this comment

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

in order to double check that something will happen after a delay, it could make sense to advance the timer after the expect(icon).not.toBeInTheDocument() check and ensure that afterwards the running man is shown. Otherwise the test could easily be false positive by never render any running gif. What do you think?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah, I agree.

Yesterday I was playing around with the different fake timer options and I found that if I advanced the timer, I still needed to use findByRole. But, I didn't like this because findByRole will succeed with or without the timer being advanced since it waits for the element to appear. So, I decided to just leave the tests above testing that the running man icon does appear.

I've just tried again adding it as a second step in this test, and in this case queryByRole is working. Based on trial and error it looks like the render must be called before advancing the timer and yesterday I was testing only the appearing case separately from the not appearing and advanced the timer at the top of the test.

Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: based on the comment, I think a better variable name would be delayShowingRunningMan. Because if the showRunningMan is false, it is shown right away instead of never, right?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Hm, after looking at the rest of the code, it seems like the variable name is correct but the comment is confusing. I think the comment should just be: If state is true, the running man animation is shown or similar because the variable itself is controlled by the delay, but not directly related.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks, this comment is unclear. I dropped the part about the delay.

Copy link
Collaborator

@raethlein raethlein left a comment

Choose a reason for hiding this comment

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

LGTM! I have just left a few minor comments.
Also for context, we have discussed offline to migrate the component to a functional one after the PR is merged.

@sfc-gh-lwilby sfc-gh-lwilby force-pushed the feature-running-man-delay branch from d7ab74e to 89117a6 Compare October 29, 2024 15:50
@sfc-gh-lwilby sfc-gh-lwilby merged commit c63cc5f into develop Oct 29, 2024
edegp pushed a commit to edegp/streamlit that referenced this pull request Jan 19, 2025
## Describe your changes

The running man animation appears while the script re-run is being
performed and for re-runs that complete quickly it introduces a flicker
and creates the perception of a longer wait. This PR introduces a delay
when showing the running man animation.

## GitHub Issue Link (if applicable)

## Testing Plan
- Unit Tests (one added to confirm not visible without delay, plus
coverage by existing running man tests)
- Manual testing by PM and Engineer to confirm expected visual
behaviour.

---

**Contribution License Agreement**

By submitting this pull request you agree that all contributions to this
project are made under the Apache 2.0 license.
@lukasmasuch lukasmasuch deleted the feature-running-man-delay branch March 7, 2025 14:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

change:feature PR contains new feature or enhancement implementation impact:users PR changes affect end users security-assessment-completed Security assessment has been completed for PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants