diff --git a/extensions/roc-package-web-app-react/app/client/create-client.js b/extensions/roc-package-web-app-react/app/client/create-client.js index ad8d67a..12a039e 100644 --- a/extensions/roc-package-web-app-react/app/client/create-client.js +++ b/extensions/roc-package-web-app-react/app/client/create-client.js @@ -75,8 +75,12 @@ export default function createClient({ createRoutes, createStore, mountNode }) { const render = () => { const node = document.getElementById(mountNode); + const forceRefreshSetting = rocConfig.runtime.history.forceRefresh; let history = useRouterHistory(createHistory)({ basename, + forceRefresh: typeof forceRefreshSetting === 'function' + ? forceRefreshSetting() + : forceRefreshSetting, }); let initialLoading = null; diff --git a/extensions/roc-package-web-app-react/src/config/roc.config.js b/extensions/roc-package-web-app-react/src/config/roc.config.js index 88775b8..23e7057 100644 --- a/extensions/roc-package-web-app-react/src/config/roc.config.js +++ b/extensions/roc-package-web-app-react/src/config/roc.config.js @@ -31,6 +31,9 @@ export default { debug: { client: 'roc:*', }, + history: { + forceRefresh: undefined, + }, configWhitelistProperty: 'DANGEROUSLY_EXPOSE_TO_CLIENT', fetch: { server: ['fetch'], diff --git a/extensions/roc-package-web-app-react/src/config/roc.config.meta.js b/extensions/roc-package-web-app-react/src/config/roc.config.meta.js index a695647..fe5c27f 100644 --- a/extensions/roc-package-web-app-react/src/config/roc.config.meta.js +++ b/extensions/roc-package-web-app-react/src/config/roc.config.meta.js @@ -1,4 +1,4 @@ -import { isString, isBoolean, isPath, isArray, isObject, notEmpty, required } from 'roc/validators'; +import { isString, isBoolean, isPath, isArray, isObject, notEmpty, required, oneOf, isFunction } from 'roc/validators'; export default { settings: { @@ -103,6 +103,12 @@ export default { }, }, }, + history: { + forceRefresh: { + description: 'Whether to force load from server rather than do single page navigation', + validator: oneOf(isBoolean, isFunction), + }, + }, }, }, };