Skip to content
This repository has been archived by the owner on Jan 2, 2018. It is now read-only.

Commit

Permalink
Setting for forceRefresh (#36)
Browse files Browse the repository at this point in the history
* Allows setting `forceRefresh`-option to `browserHistory` through Roc settings

* Fixes ESLint mistake
  • Loading branch information
PAkerstrand authored and dlmr committed Oct 11, 2016
1 parent 04ed9c6 commit 518f9c5
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 3 additions & 0 deletions extensions/roc-package-web-app-react/src/config/roc.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ export default {
debug: {
client: 'roc:*',
},
history: {
forceRefresh: undefined,
},
configWhitelistProperty: 'DANGEROUSLY_EXPOSE_TO_CLIENT',
fetch: {
server: ['fetch'],
Expand Down
Original file line number Diff line number Diff line change
@@ -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: {
Expand Down Expand Up @@ -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),
},
},
},
},
};

0 comments on commit 518f9c5

Please sign in to comment.