Skip to content

Commit

Permalink
feat: do not display the new graph card before the rest are loaded
Browse files Browse the repository at this point in the history
  • Loading branch information
davidballester committed Apr 18, 2020
1 parent 7f72c7a commit 2138dea
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/scenes/welcome/welcome.component.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ function GraphCards({ show, graphNames, openNewGraph, openGraph, className }) {
}

function Welcome({ openNewGraph, openGraph, graphNames, openImportGraph, isAuthInitialized, classes }) {
const displaySkeletons = !isAuthInitialized || !graphNames;
return (
<>
<CookieDialog />
Expand Down Expand Up @@ -131,9 +132,9 @@ function Welcome({ openNewGraph, openGraph, graphNames, openImportGraph, isAuthI
Import graph
</Button>
</div>
<SkeletonGraphs show={!isAuthInitialized} className={classes.graphList} />
<SkeletonGraphs show={displaySkeletons} className={classes.graphList} />
<GraphCards
show={isAuthInitialized}
show={!displaySkeletons}
graphNames={graphNames}
openGraph={openGraph}
openNewGraph={openNewGraph}
Expand Down
4 changes: 2 additions & 2 deletions src/scenes/welcome/welcome.duck.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export function readNamesSuccess(names) {
};
}

export default function reducer(state = {}, action) {
export default function reducer(state = null, action) {
switch (action.type) {
case GRAPH_CREATE: {
const { id, name } = action.payload;
Expand Down Expand Up @@ -60,7 +60,7 @@ export function getGraphNames(state) {

export const getGraphNamesAsArray = createSelector(
getGraphNames,
(graphNames) => entries(graphNames)
(graphNames) => (!!graphNames ? entries(graphNames) : undefined)
);

export function* doReadGraphNames() {
Expand Down

0 comments on commit 2138dea

Please sign in to comment.