Open dave4506 opened 2 months ago
I have managed to hone in on the issue; the updateFragment
function utilized by the PublicationCacheManager
returns null on non "user connected" posts.
Curiously, from looking into the apollo cache, I was able to focus in on the specific condition that allows for updateFragment
to work:
If in ROOT_QUERY
, there is a request for profile, it seems to work as intended, if there is no query there; the local cache will not work.
Found the issue, for posterity sake and for feedback to core team.
The issue relates to statsFor
for profiles.
In lensConfig, I DO NOT have any statsFor
configured. But when I was querying for these publications, I did it with the following:
const res = usePublications({
where: {
publicationTypes: [PublicationType.Post],
metadata: {
publishedOn: [LENS_APP_ID],
tags: {
all: [postTags!.txn, postTags!.chain],
},
},
},
Because of publishedOn
, profiles return stats
just for LENS_APP_ID
, there is no stats
for the case of []
(i.e all apps)
This becomes an issue because when the PublicationCacheManager
attempts to find the cache result, it passes variables
from the global config, which was set to []
for me. This meant that profiles queried by usePublications
could not be "found" because they are missing stats
for the []
condition.
I have temp fixed this by simply dropping publishedOn
. But to me, this is a bug to fix.
Hey @dave4506 thank you for the detailed explanation and the temp workaround.
Your feedback is very welcome, indeed this (the interoperability of some nested field arguments) is an area we are looking at as part of the coming iteration of the Lens API. This specifically might just be simplified altogether removing the need for a lens config property and making the publishedOn enough for all use cases.
Describe the bug Adding a reaction to a post NOT created by the signed-in user does not update the local apollo cache state, BUT updating a publication created by the signed-in user does result in a cache update.
To Reproduce Provide with as much details as possible the call, the hook, the interaction with the Lens SDK that has been problematic for you. Links to public GH repos or working examples are really appreciated.
Feels like #854 has very similar issues to me.
Expected behaviuor A clear and concise description of what you expected to happen. State should update for all publications
If using the React bindings, what is the essence of your React app?
Version of the packages you are using
Additional context Add any other context about the problem here.