8000 dont falsely redirect to intro screen by Connoropolous · Pull Request #157 · h-be/acorn-ui · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
This repository was archived by the owner on May 15, 2021. It is now read-only.

dont falsely redirect to intro screen #157

Merged
merged 1 commit into from
Aug 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion src/reducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ of how ACTIONS affect STATE
import { combineReducers } from 'redux'

import agents from './agents/reducer'
import whoami from './who-am-i/reducer'
import whoami, { hasFetchedForWhoami } from './who-am-i/reducer'
import agentAddress from './agent-address/reducer'
import projects from './projects/reducer'
import goalForm from './goal-form/reducer'
Expand All @@ -34,6 +34,7 @@ export default combineReducers({
whoami,
agentAddress,
ui: combineReducers({
hasFetchedForWhoami,
edgeConnector,
localPreferences,
goalForm,
Expand Down
5 changes: 4 additions & 1 deletion src/routes/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ function App(props) {
projectName,
agentAddress,
whoami, // .entry and .address
hasFetchedForWhoami,
updateWhoami,
navigationPreference,
setNavigationPreference,
Expand Down Expand Up @@ -86,7 +87,7 @@ function App(props) {
setShowPreferences={setShowPreferences}
/>
{!agentAddress && <LoadingScreen />}
{agentAddress && !whoami && <Redirect to='/intro' />}
{agentAddress && hasFetchedForWhoami && !whoami && <Redirect to='/intro' />}
{agentAddress && whoami && <Footer />}
</Router>
</ErrorBoundaryScreen>
Expand Down Expand Up @@ -123,6 +124,7 @@ function mapDispatchToProps(dispatch) {
function mapStateToProps(state) {
const {
ui: {
hasFetchedForWhoami,
activeProject,
activeEntryPoints,
localPreferences: { navigation },
Expand All @@ -148,6 +150,7 @@ function mapStateToProps(state) {
activeEntryPoints: activeEntryPointsObjects,
projectName,
whoami: state.whoami,
hasFetchedForWhoami,
agentAddress: state.agentAddress,
navigationPreference: navigation,
}
Expand Down
10 changes: 10 additions & 0 deletions src/who-am-i/reducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,13 @@ export default function(state = defaultState, action) {
return state
}
}

export function hasFetchedForWhoami(state = false, action) {
const { type } = action
switch (type) {
case whoami.success().type:
return true
default:
return state
}
}
0