Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
lbry
lbry-react-native
Commits
bcfb65ed
Commit
bcfb65ed
authored
Feb 25, 2020
by
Akinwale Ariwodola
Browse files
fix suggested subscriptions state handling
parent
0536f0e4
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/component/suggestedSubscriptionsGrid/view.js
View file @
bcfb65ed
...
...
@@ -18,10 +18,12 @@ class SuggestedSubscriptionsGrid extends React.PureComponent {
state
=
{
currentPage
:
1
,
options
:
{},
// maintain a local state of subscriptions so that changes don't affect the search
subscriptionIds
:
[],
};
buildClaimSearchOptions
()
{
const
{
showNsfwContent
,
subscriptions
}
=
this
.
props
;
const
{
showNsfwContent
}
=
this
.
props
;
const
{
currentPage
}
=
this
.
state
;
const
options
=
{
...
...
@@ -34,8 +36,8 @@ class SuggestedSubscriptionsGrid extends React.PureComponent {
if
(
!
showNsfwContent
)
{
options
.
not_tags
=
MATURE_TAGS
;
}
if
(
subscriptions
&&
subscriptions
.
length
>
0
)
{
options
.
not_channel_ids
=
subscriptions
.
map
(
subscription
=>
subscription
.
uri
.
split
(
'
#
'
)[
1
])
;
if
(
this
.
state
.
subscription
Id
s
.
length
>
0
)
{
options
.
not_channel_ids
=
this
.
state
.
subscriptionIds
;
}
return
options
;
...
...
@@ -65,8 +67,17 @@ class SuggestedSubscriptionsGrid extends React.PureComponent {
};
componentDidMount
()
{
const
{
claimSearch
,
followedTags
,
showNsfwContent
}
=
this
.
props
;
this
.
doClaimSearch
();
const
{
claimSearch
,
followedTags
,
showNsfwContent
,
subscriptions
}
=
this
.
props
;
if
(
subscriptions
&&
subscriptions
.
length
>
0
)
{
this
.
setState
(
{
subscriptionIds
:
subscriptions
.
map
(
subscription
=>
subscription
.
uri
.
split
(
'
#
'
)[
1
]),
},
()
=>
this
.
doClaimSearch
(),
);
}
else
{
this
.
doClaimSearch
();
}
}
render
()
{
...
...
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