fix(tagging): fix downloading links with tags #2037
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
To reproduce:
Observed behaviour: downloaded links do not reflect the URLs searched by tags in the links table
Expected behaviour: downloaded links should reflect the URLs searched by tags in the links table
The bug happens because the function
getUrls
(used by the downloader) is unable to differentiate between searching by links vs searching by tags, and incorrectly always searches by links. This is unlikegetUrlsForUser
(used by the search bar), which has some extra added logic to differentiate between the two.See Notion issue
Solution
Instead of mimicking the extra logic from
getUrlsForUser
ingetUrls
to differentiate between searching by links vs. by tags, this PR refactors the redux store such that this logic is no longer necessary. For context,searchText
in the redux store is currently being overloaded for use in both searching by links and searching by tags. This PR refactors it by splitting it out into separate fieldssearchText
andtags
, which is better because it is consistent with the backend API.I've also renamed
searchTextInput
tosearchInput
to disambiguate it fromsearchText
. Now,searchInput
can either be dispatched tosearchText
ortags
, depending on theisTag
boolean variable.Tests