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

[Overlay] better lifecycle props for all overlay components #2581

Merged
merged 11 commits into from
Jun 12, 2018

Conversation

giladgray
Copy link
Contributor

Fixes #2402

Changes proposed in this pull request:

  • IOverlayLifecycleProps defines onOpening, onOpened, onClosing, onClosed
    • 4 methods passed directly to CSSTransition to leverage their reliable code
    • 🔥this results in slightly different semantics, mainly that the popover content is always mounted in the DOM during any of these lifecycles.
      • previously, in onOpening and onClosed the content was not in the DOM (before entering or after exiting, respectively)
  • 🔥 replace Overlay didOpen, didClose props with those above
  • 🔥 replace Popover popoverDid/Will* props with those above

Reviewers should focus on:

slightly different semantics, mainly that the popover content is always mounted in the DOM during any of these lifecycles.

could this be an issue? @invliD thoughts?

@blueprint-bot
Copy link

fix lint & tests

Preview: documentation | landing | table

@@ -56,6 +52,7 @@ class ContextMenu extends AbstractPureComponent<IContextMenuProps, IContextMenuS
return (
<div className={Classes.CONTEXT_MENU_POPOVER_TARGET} style={this.state.offset}>
<Popover
{...this.props}
Copy link
Contributor

Choose a reason for hiding this comment

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

this seems like a pretty major change where users could possible pass props to the popover this way, now they can't.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this component is not even exported, so it think we're safe here. users use either a decorator @ContextMenuTarget or a static method ContextMenu.show() (which looks like this component but isn't).

/** Lifecycle method invoked when an Overlay has finished transitioning to the closed state. */
onClosed?: () => void;

/** Lifecycle method invoked when an Overlay begins to open. */
Copy link
Contributor

Choose a reason for hiding this comment

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

i think it might be clearer to say:
Lifecycle method invoked just before an Overlay begins to open.

Because we're dealing with transitions, "when" is ambiguous so we should say "before" or "after" the transition.

Same with onClosing

@@ -134,31 +134,11 @@ export interface IPopoverProps extends IOverlayableProps, IProps {
*/
popoverClassName?: string;

Copy link
Contributor

Choose a reason for hiding this comment

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

this is a major API deprecation. What is the upgrade path for existing code?

Copy link
Contributor

Choose a reason for hiding this comment

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

Note: this interface inherits the new lifecycle interface, so this will just be a rename.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@blueprint-bot
Copy link

improve lifecycle prop docs

Preview: documentation | landing | table

@blueprint-bot
Copy link

add node to select usages

Preview: documentation | landing | table

@giladgray
Copy link
Contributor Author

@themadcreator can you review my recent commits? made some changes worth looking at.

@giladgray giladgray merged commit 7706105 into develop Jun 12, 2018
@giladgray giladgray deleted the gg/overlay-lifecycle branch June 12, 2018 19:47
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.

3 participants