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

[DEPRECATION] deprecate Component#isVisible #17948

Merged
merged 1 commit into from
Oct 17, 2019

Conversation

GavinJoyce
Copy link
Member

@GavinJoyce GavinJoyce commented Apr 18, 2019

part of #17918

TODO:

@GavinJoyce GavinJoyce force-pushed the gj/deprecate-isVisible branch 3 times, most recently from 30e73fa to 0de9dec Compare April 18, 2019 19:43
@GavinJoyce GavinJoyce changed the title [WIP] add isVisible deprecation warning Add isVisible deprecation warning Apr 18, 2019
@GavinJoyce GavinJoyce force-pushed the gj/deprecate-isVisible branch 2 times, most recently from 9f9300e to 7f35156 Compare April 18, 2019 21:20
Copy link
Member

@rwjblue rwjblue left a comment

Choose a reason for hiding this comment

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

Looking good! I left some minor inline comments for tweaks, but we also need to flag this for svelting.

The rough steps for svelting are:

  • Add a new export from packages/@ember/deprecated-features/index.js, the string value should be 3.11.0-beta.1 (which will be the first tagged release including the deprecation)
  • Import that boolean flag and surround any code supporting isVisible with a conditional (e.g. if (EMBER_COMPONENT_IS_VISIBLE) { /* code here */ })

Some example PRs adding svelting as part of a deprecation:

The goal here is that any code that is supporting a deprecated feature will (eventually) be able to be stripped from apps that declare that they are "deprecation free" for a given version.

packages/@ember/-internals/glimmer/lib/utils/bindings.ts Outdated Show resolved Hide resolved
packages/@ember/-internals/glimmer/lib/utils/bindings.ts Outdated Show resolved Hide resolved
@rwjblue
Copy link
Member

rwjblue commented Apr 19, 2019

Oh, also noticed, we should update the docs for isVisible with @deprecated.

@rwjblue
Copy link
Member

rwjblue commented Apr 19, 2019

@GavinJoyce - Sorry for being spammy here, I updated the PR description with a checklist...

@GavinJoyce GavinJoyce changed the title Add isVisible deprecation warning [WIP] Add isVisible deprecation warning Apr 19, 2019
@GavinJoyce GavinJoyce force-pushed the gj/deprecate-isVisible branch 4 times, most recently from 4f5fda9 to d8242f9 Compare October 14, 2019 15:34
@GavinJoyce GavinJoyce changed the title [WIP] Add isVisible deprecation warning [DEPRECATION] deprecate isVisible Oct 14, 2019
@GavinJoyce GavinJoyce changed the title [DEPRECATION] deprecate isVisible [DEPRECATION] deprecate Component#isVisible Oct 14, 2019
@locks locks self-assigned this Oct 14, 2019
@GavinJoyce GavinJoyce force-pushed the gj/deprecate-isVisible branch 5 times, most recently from 81d787c to 5f78612 Compare October 16, 2019 10:37
Copy link
Member

@rwjblue rwjblue left a comment

Choose a reason for hiding this comment

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

Looks really good, only one more small nit and I think we are good (once the deprecation guide lands).

// // think it should be a Reference<string|null>.
// operations.addDynamicAttribute(element, 'style', ref as any as Reference<string>, false);
},
export let IsVisibleBinding: any;
Copy link
Member

Choose a reason for hiding this comment

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

any is a bit unfortunate here, can we make it:

export let IsVisibleBinding: undefined | {
  install(element: Simple.Element, component: Component, operations: ElementOperations): void;
};

(I think mapStyleValue is only used internally?)

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks, I've updated it to:

export let IsVisibleBinding: undefined | {
  install(element: Simple.Element, component: Component, operations: ElementOperations): void;
  mapStyleValue(isVisible: boolean, component: Component): SafeString | null;
};

With my currently limited knowledge of TS, I couldn't find a way to mark mapStyleValue as private.

@GavinJoyce GavinJoyce force-pushed the gj/deprecate-isVisible branch 2 times, most recently from 977c92b to 9960335 Compare October 17, 2019 08:48
@GavinJoyce
Copy link
Member Author

@rwjblue thanks for all the feedback, that will help me a lot in future deprecations.

This and ember-learn/deprecation-app#451 are ready I believe

Copy link
Member

@rwjblue rwjblue left a comment

Choose a reason for hiding this comment

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

Two very minor nit-pick's, but otherwise this is good to go...

@rwjblue
Copy link
Member

rwjblue commented Oct 17, 2019

Sorry @GavinJoyce, looks like a prettier error in CI now:

$ eslint . --cache --ext=js,ts
/home/travis/build/emberjs/ember.js/packages/@ember/-internals/glimmer/lib/component-managers/curly.ts
  96:7  error  Replace `EMBER_COMPONENT_IS_VISIBLE·&&·IsVisibleBinding·!==·undefined·&&·seen.indexOf('style')·===·-1` with `⏎····EMBER_COMPONENT_IS_VISIBLE·&&⏎····IsVisibleBinding·!==·undefined·&&⏎····seen.indexOf('style')·===·-1⏎··`  prettier/prettier

@GavinJoyce
Copy link
Member Author

sorry - updated, thanks

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