-
Notifications
You must be signed in to change notification settings - Fork 0
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
"Other Pools" do not load when a wallet is connected #1
Comments
I am able to query hive-graph directly through the GraphQL Playground and get the expected results, confirming that it is not a contract issue. |
Apparently the An easy and naive fix, which assumes export const requestInChunks = async <Item = any, Response = any>(
chunkSize: number,
url: string,
items: Item[],
queryBuilder: (chunk: Item[]) => string
): Promise<Response> => {
const firstQuery = queryBuilder(items.slice(0, 1));
const wasmCallsPerQuery = ((firstQuery).match(/wasm {/g) || []).length;
const correctedChunkSize = Math.floor(chunkSize / (wasmCallsPerQuery || 1));
const totalChunks = Math.ceil(items.length / correctedChunkSize);
const chunks = await Promise.all(
Array.from(Array(totalChunks).keys()).map((i) => {
const chunk = items.slice(i * correctedChunkSize, (i + 1) * correctedChunkSize);
console.log(queryBuilder(chunk));
return request<Response>(url, queryBuilder(chunk));
})
);
return chunks.reduce((all, chunk) => ({ ...all, ...chunk }));
}; Alternatively we could use export const requestInChunks = async <Item = any, Response = any>(
chunkSize: number,
url: string,
items: Item[],
queryBuilder: (chunk: Item[]) => string
): Promise<Response> => {
const query = queryBuilder(items);
const { kind, loc, selections } = (parse(query).definitions[0] as OperationDefinitionNode).selectionSet;
const selectionChunks = _.chunk(selections, chunkSize);
const chunks = selectionChunks.map((chunk) => print({ kind, loc: loc!, selections: chunk ?? [] }));
const requests = await Promise.all(chunks.map((chunk) => request<Response>(url, chunk)));
return requests.reduce((all, chunk) => ({ ...all, ...chunk }));
}; |
This seems like the better / more scalable approach to me |
The page for /pools contains a list of "Other Pools", which loads as long as a wallet is not connected. However as soon as this condition changes, the list refuses to load, suggesting a malformed hive-graph request or similar.
The text was updated successfully, but these errors were encountered: