fix(proposals): error policy guard for proposal data provider (#4573)

This commit is contained in:
Art 2023-08-22 18:58:01 +02:00 committed by GitHub
parent 78414b4429
commit afd8650657
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -17,4 +17,17 @@ export const proposalsDataProvider = makeDataProvider<
never,
never,
ProposalsListQueryVariables
>({ query: ProposalsListDocument, getData });
>({
query: ProposalsListDocument,
getData,
/**
* Ignores errors for not found settlement asset for NewMarket proposals.
*
* It can happen that a NewMarket proposal is incomplete and does not contain
* `futureProduct` details. This guard protects against that.
*
* GQL Path: `terms.change.instrument.futureProduct.settlementAsset`
*/
errorPolicyGuard: (errors) =>
errors.every((e) => e.message.match(/failed to get asset for ID/)),
});