diff --git a/README.md b/README.md index 8c441d2..facdf3e 100644 --- a/README.md +++ b/README.md @@ -85,7 +85,7 @@ npm start The Bee Dashboard runs in development mode on [http://localhost:3031/](http://localhost:3031/) -> Setting `REACT_APP_DEV_MODE=1` environment variable loosens some checks. This makes it possible to develop Bee Dashboard without having connected peers and chequebook properly set up, effectively supporting the dev mode of Bee itself. +> Setting the `REACT_APP_DEV_MODE=1` environment variable, or opening Bee Dashboard with the query string `?devMode=1` loosens some checks. This makes it possible to develop Bee Dashboard without having connected peers and chequebook properly set up, effectively supporting the dev mode of Bee itself. ## Contribute diff --git a/src/providers/Bee.tsx b/src/providers/Bee.tsx index e42fa43..ed73d99 100644 --- a/src/providers/Bee.tsx +++ b/src/providers/Bee.tsx @@ -51,6 +51,8 @@ interface ContextInterface { refresh: () => Promise } +const startedInDevMode = window.location.search.includes('devMode=1') + const initialValues: ContextInterface = { status: { all: false, @@ -102,6 +104,8 @@ function getStatus( chequebookBalance: ChequebookBalance | null, error: Error | null, ): Status { + // FIXME: `devMode` is a temporary workaround to be able to develop with only one node + const devMode = startedInDevMode || Boolean(process.env.REACT_APP_DEV_MODE) const status = { version: Boolean( debugApiHealth && @@ -112,13 +116,12 @@ function getStatus( blockchainConnection: Boolean(nodeAddresses?.ethereum), debugApiConnection: Boolean(debugApiHealth?.status === 'ok'), apiConnection: apiHealth, - // FIXME: `REACT_APP_DEV_MODE` is a temporary workaround to be able to develop with only one node - topology: Boolean(topology?.connected && topology?.connected > 0) || Boolean(process.env.REACT_APP_DEV_MODE), + topology: Boolean(topology?.connected && topology?.connected > 0) || devMode, chequebook: (Boolean(chequebookAddress?.chequebookAddress) && chequebookBalance !== null && chequebookBalance?.totalBalance.toBigNumber.isGreaterThan(0)) || - Boolean(process.env.REACT_APP_DEV_MODE), + devMode, } return { ...status, all: !error && Object.values(status).every(v => v) }