Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
coopwire-hypothesis
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
孙灵跃 Leon Sun
coopwire-hypothesis
Commits
12a1efcb
Unverified
Commit
12a1efcb
authored
Dec 06, 2019
by
Robert Knight
Committed by
GitHub
Dec 06, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1565 from hypothesis/avoid-effect-in-tag-list
Avoid effect in tag list
parents
8fb123f9
54a3469e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
7 deletions
+5
-7
tag-list.js
src/sidebar/components/tag-list.js
+5
-7
No files found.
src/sidebar/components/tag-list.js
View file @
12a1efcb
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
const
{
createElement
}
=
require
(
'preact'
);
const
{
createElement
}
=
require
(
'preact'
);
const
propTypes
=
require
(
'prop-types'
);
const
propTypes
=
require
(
'prop-types'
);
const
{
use
Effect
,
useState
}
=
require
(
'preact/hooks'
);
const
{
use
Memo
}
=
require
(
'preact/hooks'
);
const
{
isThirdPartyUser
}
=
require
(
'../util/account-id'
);
const
{
isThirdPartyUser
}
=
require
(
'../util/account-id'
);
const
{
withServices
}
=
require
(
'../util/service-context'
);
const
{
withServices
}
=
require
(
'../util/service-context'
);
...
@@ -11,13 +11,11 @@ const { withServices } = require('../util/service-context');
...
@@ -11,13 +11,11 @@ const { withServices } = require('../util/service-context');
* Component to render an annotation's tags.
* Component to render an annotation's tags.
*/
*/
function
TagList
({
annotation
,
serviceUrl
,
settings
,
tags
})
{
function
TagList
({
annotation
,
serviceUrl
,
settings
,
tags
})
{
// Should we show a linked tag or just a text tag?
const
renderLink
=
useMemo
(
const
[
renderLink
,
setRenderLink
]
=
useState
(
false
);
useEffect
(()
=>
{
// Show a link if the authority of the user is not 3rd party
// Show a link if the authority of the user is not 3rd party
setRenderLink
(
!
isThirdPartyUser
(
annotation
.
user
,
settings
.
authDomain
));
()
=>
!
isThirdPartyUser
(
annotation
.
user
,
settings
.
authDomain
),
},
[
annotation
,
settings
]);
[
annotation
,
settings
]
);
/**
/**
* Returns a uri link for a specific tag name.
* Returns a uri link for a specific tag name.
...
...
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