Webiny-js: Page Builder - updating domain in PB settings doesn't get immediately reflected in the rest of the app

Created on 8 Jun 2020  路  2Comments  路  Source: webiny/webiny-js

Basically, once you update the domain in PB settings, the change should be immediately reflected in the rest of the Page Builder.

Currently, if you update the settings, and open the Page Builder editor, and click on the Preview button, the old domain would still be used. It would only work if the user refreshed the whole page, which is, of course, not a solution.

Make sure everything works immediately on the domain update.

Hint: it's possible that, when fetching settings via GQL, that the id field is not included in the response, which prevents Apollo from proper caching / updating the cache.

bug

Most helpful comment

@Ashu96 Or maybe update the apollo cache manually on the client side, to avoid extra api calls.

All 2 comments

Hey @doitadrian
The solution that you suggested which is adding id in GQL query will not work, because currently id is not getting resolved by GQL.

image

And the reason for that is we only get data key from Settings collection via Settings Manager checkout packages/api-settings-manager/src/handler/index.ts:16


One possible solution is, using refetchQueries option in updateSettings mutation in
packages/app-page-builder/src/admin/plugins/settings/components/generalSettings/GeneralSettings.tsx:30


Here is how it will looks:

https://www.loom.com/share/81a083db4f404e3cb725e4d0090c1016

@Ashu96 Or maybe update the apollo cache manually on the client side, to avoid extra api calls.

Was this page helpful?
0 / 5 - 0 ratings