mirror of
https://github.com/FrankerFaceZ/FrankerFaceZ.git
synced 2025-08-03 08:28:31 +00:00
If we need to refetch a query in .ensureQuery
or .getFromQuery
because the results don't have the data we have requested, make a shallow copy of the query document to ensure a cache miss from Apollo's transformDocument
method.
This ensures that Apollo uses our newly modified query document when performing the actual request.
This commit is contained in:
parent
5429f4d329
commit
b79e910100
1 changed files with 14 additions and 1 deletions
|
@ -298,10 +298,18 @@ export default class Apollo extends Module {
|
|||
|
||||
if ( ! passed && Date.now() - (query._ffz_last_retry || 0) >= retry_wait ) {
|
||||
query._ffz_last_retry = Date.now();
|
||||
|
||||
// Make a shallow clone of the query document to avoid hitting the
|
||||
// cache in transformDocument.
|
||||
query.options.query = Object.assign({}, query.options.query);
|
||||
|
||||
if ( delay === 0 )
|
||||
query.refetch();
|
||||
else if ( delay > 0 )
|
||||
setTimeout(() => query.refetch(), delay);
|
||||
setTimeout(() => {
|
||||
//debugger;
|
||||
query.refetch()
|
||||
}, delay);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -330,6 +338,11 @@ export default class Apollo extends Module {
|
|||
|
||||
if ( out === undefined && Date.now() - (query._ffz_last_retry || 0) >= retry_wait ) {
|
||||
query._ffz_last_retry = Date.now();
|
||||
|
||||
// Make a shallow clone of the query document to avoid hitting the
|
||||
// cache in transformDocument.
|
||||
query.options.query = Object.assign({}, query.options.query);
|
||||
|
||||
if ( delay === 0 )
|
||||
query.refetch();
|
||||
else if ( delay > 0 )
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue