fix: fix incorrect follow status on followers and following pages #2669
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.
fix #2668
There were two cases missed by the current implementation:
[id1, id2]
, the response can be[relationship2, relationship1]
.[id1, id2, id3]
can result in the response[relationship1, relationship3]
.This fix ensures using only returned relationships and updating the correct corresponding relationship data with the same ID.
Debugging notes
I inserted the following logs here to see how the relationship value is assigned:
elk/composables/masto/relationship.ts
Line 32 in 3448335
I got the results like the following:
which means that for example, the fetched relationship for the user ID 111186761817498794 is stored as the relationship for the user ID 1. This is clearly wrong.
This is the example logs after the fix: