-
Notifications
You must be signed in to change notification settings - Fork 11.4k
[Graphql] graphql query not getting new data #21006
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Thank you for opening this issue, a team member will review it shortly. Until then, please do not interact with any users that claim to be from Sui support and do not click on any links! |
Thanks for trying out graphql beta! This is expected behavior: per https://docs.sui.io/concepts/graphql-rpc#consistency, "a future call to fetch the next page of results using the cursors returned by the first query continues to read from the network at checkpoint X, even if data for future checkpoints is now available." This is so that when resolving other components of these transaction blocks, such as the balance changes or output state of objects, we return the correct state as anchored at the time of query. However, that indeed means that new transactions will not appear when submitting requests with a cursor. May I ask what your query is serving? Could you instead do |
@wlmyng You mean by replacing first with last to achieve a descending sort (new data is always at the beginning) Right? const response = await publicClient.queryTransactionBlocks({
filter: {
ChangedObject: "0xxxxxxx",
},
order: 'ascending',
cursor: lastTxRecord,
limit: 50,
options: {
showEvents: true,
},
}); There is also a detail, if you start localnet, with sdk
|
Env
network:
testnet
graphql api:
https://sui-testnet.mystenlabs.com/graphql
Description
When I use graphql for the first time to query the data, it can query the cursor for each data, then I use the cursor to page it to the last page and when there is new data coming in, it can't retrieve the new data.
this is my query:
this is the query result:
You can see that there are several new transactions, but the new data is not queried through the previous cursor. The only way to query the new data is to re-query and re-construct the cursor, but this very much affects the efficiency and logic of the query.
https://testnet.suivision.xyz/account/0xb0637946747572b54d4a91ece3b8fc6d370d236dbc70382f5304445cc999a36f?tab=Transaction+Blocks
My goal
I need to page through queries based on the cursor and when there is new data, I can query the last cursor of the previous record for the new data.
Also I would like to confirm how transactionBlocks sets the orderBy or what is the logic of its default orderBy?
The text was updated successfully, but these errors were encountered: