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

UIP-1802 CSS Transition Timeout/Warning #55

Conversation

kaanaksoy-wk
Copy link
Contributor

@kaanaksoy-wk kaanaksoy-wk commented Mar 9, 2017

Ultimate problem:

When creating components that utilize the AbstractTransitionComponent, it's possible to set transition to a value that something like an OverlayTrigger doesn't know about, which causes the cleanup of the component to hang.

How it was fixed:

  • Add a timeout to ensure that the component is cleaned up even if something goes wrong with the transition, and warn the consumer.
    • Add a transitionTimeout getter to AbstractTransitionComponent that can be overridden to adjust the desired timeout duration.
    • Use a Timer and display a warning after a timeout has occurred.
    • Write a test to verify that the timeout actually occurs.

Testing suggestions:

  • Verify that the tests pass.

Potential areas of regression:

  • N/A

FYA: @greglittlefield-wf @aaronlademann-wf @jacehensley-wf @clairesarsam-wf @joelleibow-wf

@aviary-wf
Copy link

aviary-wf commented Mar 9, 2017

Raven

Number of Findings: 0

@kaanaksoy-wk kaanaksoy-wk changed the base branch from 1.3.0 to release_1.7.0 March 9, 2017 17:44
@codecov-io
Copy link

codecov-io commented Mar 9, 2017

Codecov Report

Merging #55 into release_1.7.0 will increase coverage by 0.01%.
The diff coverage is 100%.

@@                Coverage Diff                @@
##           release_1.7.0      #55      +/-   ##
=================================================
+ Coverage          97.71%   97.72%   +0.01%     
=================================================
  Files                 28       28              
  Lines               1352     1356       +4     
=================================================
+ Hits                1321     1325       +4     
  Misses                31       31

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 425dbaa...f82f71b. Read the comment docs.

Copy link
Contributor

@jacehensley-wf jacehensley-wf left a comment

Choose a reason for hiding this comment

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

Just a few pieces of feedback

@@ -123,6 +123,9 @@ abstract class AbstractTransitionComponent<T extends AbstractTransitionProps, S
/// Whether the Element returned by [getTransitionDomNode] will have a transition event.
bool get hasTransition => true;

/// The duration that can elapse before a transition timeout occurs.
Duration get transitionTimeout => const Duration(seconds: 15);
Copy link
Contributor

Choose a reason for hiding this comment

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

We should have a discussion around the default value for this.

@aaronlademann-wf @greglittlefield-wf @clairesarsam-wf @joelleibow-wf

Copy link
Contributor

Choose a reason for hiding this comment

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

I'd say make this a prop so that it's configurable, and default it to something much smaller, like 1s, so that consumers see the warning right away.

Copy link
Contributor

Choose a reason for hiding this comment

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

I feel like a getter is better for this, similar to hasTransition. That way consumers have the ability to either proxy it with a prop or have a custom implementation.

1s sounds good to me tho.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, the only reason I said prop is that it would be easier to override. Good point, I'm fine leaving it as a getter.

@@ -184,7 +187,12 @@ abstract class AbstractTransitionComponent<T extends AbstractTransitionProps, S
skipCount = 0;
}

var timer = new Timer(transitionTimeout, () {
assert(ValidationUtil.warn("A transition timeout has occurred."));
Copy link
Contributor

Choose a reason for hiding this comment

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

#nit Should use single quotes ' vs "

@@ -184,7 +187,12 @@ abstract class AbstractTransitionComponent<T extends AbstractTransitionProps, S
skipCount = 0;
}

var timer = new Timer(transitionTimeout, () {
assert(ValidationUtil.warn("A transition timeout has occurred."));
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be a more informative message. Something like: 'The amount of transitions expected to complete have not completed. Something is most likely wrong.' The wording isn't great but something that get across the point that we are expecting some amount of transitions and they have not fired.


TransitionerComponent transitioner = getDartComponent(renderedInstance);

transitioner.hide();
Copy link
Contributor

Choose a reason for hiding this comment

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

You should add a expect before and after this that verifies that the state.transtionPhase is TransitionPhase.SHOWN.

var timer = new Timer(transitionTimeout, () {
assert(ValidationUtil.warn(
'The number of transitions expected to complete have not completed. Something is most likely wrong.'
));
Copy link
Contributor

Choose a reason for hiding this comment

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

Something else that I was thinking about. Should we still call complete if the timer completes? I could go either way, was just wondering what the desired behavior is.

Copy link
Contributor

Choose a reason for hiding this comment

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

Mm, yes, we should, in order to account for when the warning isn't caught by the time this is deployed

@@ -444,6 +471,7 @@ class TransitionerComponent extends AbstractTransitionComponent<TransitionerProp
..addProps(super.getDefaultProps())
..hasTransition = true
..initiallyShown = true
..transitionTimeout = const Duration(seconds: 15)
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be updated to match the default in AbstractTransitionComponent

@jacehensley-wf
Copy link
Contributor

+1

@aaronlademann-wf aaronlademann-wf changed the title UIP-1802 Modal Transition Timeout/Warning UIP-1802 CSS Transition Timeout/Warning Mar 16, 2017
@aaronlademann-wf
Copy link
Contributor

aaronlademann-wf commented Mar 16, 2017

  • Testing instruction
  • Dev +1's
  • Dev/QA +10
  • Unit tests created/updated
  • All unit tests pass
  • Rosie ran/Rosie comment displays expected info
  • Dependency Scan Clean

Merging.+10

@teresarevious-wf
Copy link

RM +1 verified dependencies

greglittlefield-wf added a commit that referenced this pull request Jun 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants