fix: fetch subscriptions if there are no claims loaded #1652
No reviewers
Labels
No labels
accessibility
app-parity
area: creator
area: daemon
area: design
area: devops
area: discovery
area: docs
area: installer
area: internal
area: livestream
area: performance
area: proposal
area: reposts
area: rewards
area: search
area: security
area: subscriptions
area: sync
area: ux
area: viewer
area: wallet
BEAMER
channel
comments
community PR
consider soon
core team
css
dependencies
electron
Epic
feature request
first-timers-only
good first issue
hacktoberfest
help wanted
hub-dependent
icebox
Invalid
level: 0
level: 1
level: 2
level: 3
level: 4
merge when green
needs: exploration
needs: grooming
needs: priority
needs: repro
needs: tech design
notifications
odysee
on hold
playlists
priority: blocker
priority: high
priority: low
priority: medium
protocol dependent
recsys
redesign
regression
resilience
sdk dependent
Tom's Wishlist
trending
type: bug
type: discussion
type: improvement
type: new feature
type: refactor
type: task
type: testing
unplanned
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: LBRYCommunity/lbry-desktop#1652
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "subscriptions-fix"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
#1516
Sometimes, a claim id would be added to
byId
in redux state even if there are no claims loaded. Maybe that shouldn't happen? This ensures that the claim has no uris loaded before fetching, before we were just checking if the claim id existed in redux or not.Somehow this magic seems to work.
@seanyesmunt welcome to complex application state. To quote the famous programer T.S. Elliot:
When you've reached sufficient complexity, you'll inevitably reach a point where you understand that a function receives bad input but you don't understand why or how. Sometimes, as in this case, it's possible to adjust or tweak the function to accept or handle the unexpected data.
Now you have a choice.
You can make this fix, which is quick and easy. But you haven't addressed the underlying cause. Something is causing a data state to exist that doesn't make sense. This hasn't solved that problem, it's just hidden it. But that's not the only problem. Now even if the underlying cause is fixed, there's no connection between that fix and this code. The most likely scenario is that this check remains for as long as this file exists, because no one will ever come across that line and think to remove it. Which means the complexity and cost of carrying that line (which admittedly is fairly low in this specific case), persists for a very long time.
This might sound like I'm arguing against this change, and while I kind of am, the other choice also sucks. Because the other choice is track down why and how you've got a state that doesn't make sense, which might be idiosyncratic and a big time-waster, when you could just make this simple one-line fix and get back to doing something people actually care about.
There is a third-way, which is to add these types of checks (which let you get back to doing useful stuff), but code them in such a way that makes it more feasible to eventually solve the underlying problem as well as not let this check get stuck once the problem is fixed.
Here's an example of what that might look like:
Lol, I may have went overboard on my comment if this is just due to empty channels. But hopefully the lesson made sense even if it didn't apply here.
Nope, it's more than just empty channels. I'm going to help figure this beast out one day :)
I'm going to merge this now, but continue to work on it today/tonight.
Figured it is better to add now because it is currently a really bad experience
A better solution was to just get rid of all of this in the component.
https://github.com/lbryio/lbry-desktop/pull/1897/files