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

docs(Visibility|Ref): deprecate components #4324

Merged
merged 1 commit into from Jan 23, 2022

Conversation

layershifter
Copy link
Member

@layershifter layershifter commented Jan 23, 2022

⚠️ Deprecation notice

This PR marks Visibility and Ref components as deprecated. We will remove them in the next major release, i.e. 3.0.0.

<Ref />

Internally this component uses ReactDOM.findDOMNode() that has been deprecated in StrictMode (#3819). It's not supported in Concurrent mode, too ( ´・・)ノ(._.) This means that usage of .findDOMNode()` will be problem with upcoming React 18.

Migration

Semantic UI React v3 will support native ref forwarding via React.forwardRef(), but to prevent breaks during upgrade we suggest to import it from a dedicated package:

-import { Ref } from "semantic-ui-react";
+import Ref from "@semantic-ui-react/component-ref";

<Visibility />

The main reason for deprecation and upcoming removal is performance that is far away from native APIs, even in our docs we use Intersection Observer API (#3985).

Migration

We suggest to use Intersection Observer API directly or via React wrappers, for example: react-intersection-observer. As it's not a straightforward replacement that may cause issues with adoption we moved out Visibility component to a separate package (@semantic-ui-react/component-visibility). This means that you can use it already with v2 or upcoming v3:

-import { Visibility } from "semantic-ui-react";
+import Visibility from "@semantic-ui-react/component-visibility";

@layershifter layershifter force-pushed the chore/deprecate-ref-n-visibility branch from 0397115 to 6b3d3aa Compare January 23, 2022 19:54
@github-actions
Copy link

size-limit report

Path Size
bundle-size/dist/Button.size.js 58.76 KB (0%)
bundle-size/dist/Icon.size.js 25.21 KB (0%)
bundle-size/dist/Image.size.js 53.91 KB (0%)
bundle-size/dist/Modal.size.js 68.9 KB (0%)
bundle-size/dist/Portal.size.js 40.61 KB (0%)

@codecov-commenter
Copy link

codecov-commenter commented Jan 23, 2022

Codecov Report

Merging #4324 (6b3d3aa) into master (e500234) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #4324   +/-   ##
=======================================
  Coverage   99.75%   99.75%           
=======================================
  Files         180      180           
  Lines        3245     3245           
=======================================
  Hits         3237     3237           
  Misses          8        8           
Impacted Files Coverage Δ
src/behaviors/Visibility/Visibility.js 100.00% <ø> (ø)

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 e500234...6b3d3aa. Read the comment docs.

@layershifter layershifter marked this pull request as ready for review January 23, 2022 20:07
@layershifter layershifter merged commit af9a85c into master Jan 23, 2022
@layershifter layershifter deleted the chore/deprecate-ref-n-visibility branch January 23, 2022 20:07
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.

None yet

2 participants