Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
ant-design-pro
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
duanledexianxianxian
ant-design-pro
Commits
348c6284
Unverified
Commit
348c6284
authored
May 16, 2019
by
afc163
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix setState after unmount
parent
4a89fa12
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
2 deletions
+5
-2
src/components/Charts/Pie/index.js
src/components/Charts/Pie/index.js
+5
-2
No files found.
src/components/Charts/Pie/index.js
View file @
348c6284
...
...
@@ -41,6 +41,9 @@ class Pie extends Component {
window
.
cancelAnimationFrame
(
this
.
requestRef
);
window
.
removeEventListener
(
'
resize
'
,
this
.
resize
);
this
.
resize
.
cancel
();
if
(
this
.
chartDom
)
{
this
.
resizeObserverInstance
.
unobserve
(
this
.
chartDom
);
}
}
getG2Instance
=
chart
=>
{
...
...
@@ -94,7 +97,7 @@ class Pie extends Component {
};
resizeObserver
()
{
const
ro
=
new
ResizeObserver
(
entries
=>
{
this
.
resizeObserverInstance
=
new
ResizeObserver
(
entries
=>
{
const
{
height
}
=
entries
[
0
].
contentRect
;
this
.
setState
(
preState
=>
{
if
(
preState
.
height
!==
height
)
{
...
...
@@ -106,7 +109,7 @@ class Pie extends Component {
});
});
if
(
this
.
chartDom
)
{
ro
.
observe
(
this
.
chartDom
);
this
.
resizeObserverInstance
.
observe
(
this
.
chartDom
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment