Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
W
wax-prosemirror
Manage
Activity
Members
Labels
Plan
Issues
34
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
2
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container Registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
wax
wax-prosemirror
Commits
64e0e314
Commit
64e0e314
authored
4 years ago
by
chris
Browse files
Options
Downloads
Patches
Plain Diff
fix rerender comments
parent
8494fc34
No related branches found
No related tags found
1 merge request
!166
Fixes
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
wax-prosemirror-components/src/components/comments/ConnectedComment.js
+22
-17
22 additions, 17 deletions
...or-components/src/components/comments/ConnectedComment.js
with
22 additions
and
17 deletions
wax-prosemirror-components/src/components/comments/ConnectedComment.js
+
22
−
17
View file @
64e0e314
/* eslint react/prop-types: 0 */
/* eslint react/prop-types: 0 */
import
React
,
{
useContext
,
m
emo
}
from
'
react
'
;
import
React
,
{
useContext
,
useM
emo
}
from
'
react
'
;
import
{
TextSelection
}
from
'
prosemirror-state
'
;
import
{
TextSelection
}
from
'
prosemirror-state
'
;
import
{
last
,
maxBy
}
from
'
lodash
'
;
import
{
last
,
maxBy
}
from
'
lodash
'
;
import
styled
from
'
styled-components
'
;
import
styled
from
'
styled-components
'
;
...
@@ -17,7 +17,6 @@ const ConnectedCommentStyled = styled.div`
...
@@ -17,7 +17,6 @@ const ConnectedCommentStyled = styled.div`
`
;
`
;
export
default
({
comment
,
top
,
commentId
,
recalculateTops
})
=>
{
export
default
({
comment
,
top
,
commentId
,
recalculateTops
})
=>
{
// const MemorizedComponent = memo(() => {
const
{
const
{
view
,
view
,
view
:
{
view
:
{
...
@@ -138,21 +137,27 @@ export default ({ comment, top, commentId, recalculateTops }) => {
...
@@ -138,21 +137,27 @@ export default ({ comment, top, commentId, recalculateTops }) => {
}
}
};
};
return
(
const
MemorizedComponent
=
useMemo
(
<
ConnectedCommentStyled
data
-
box
=
{
commentId
}
style
=
{
styles
}
active
=
{
active
}
>
()
=>
(
<
CommentBox
<
ConnectedCommentStyled
key
=
{
commentId
}
data
-
box
=
{
commentId
}
style
=
{
styles
}
active
=
{
active
}
active
=
{
active
}
commentId
=
{
commentId
}
>
commentData
=
{
comment
.
attrs
.
conversation
}
<
CommentBox
onClickPost
=
{
onClickPost
}
key
=
{
commentId
}
onClickBox
=
{
onClickBox
}
active
=
{
active
}
onClickResolve
=
{
onClickResolve
}
commentId
=
{
commentId
}
recalculateTops
=
{
recalculateTops
}
commentData
=
{
comment
.
attrs
.
conversation
}
onTextAreaBlur
=
{
onTextAreaBlur
}
onClickPost
=
{
onClickPost
}
/
>
onClickBox
=
{
onClickBox
}
<
/ConnectedCommentStyled
>
onClickResolve
=
{
onClickResolve
}
recalculateTops
=
{
recalculateTops
}
onTextAreaBlur
=
{
onTextAreaBlur
}
/
>
<
/ConnectedCommentStyled
>
),
[
active
,
top
,
comment
.
attrs
.
conversation
.
length
],
);
);
// });
return
<>
{
MemorizedComponent
}
<
/>
;
// return <MemorizedComponent />;
};
};
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment