Skip to content

Commit

Permalink
fixed show progress in dexterity and other places, removed flicker wh…
Browse files Browse the repository at this point in the history
…en going back to home
  • Loading branch information
Alex Medesan committed Apr 26, 2021
1 parent 89ffcd6 commit f2ce4f0
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/ProgressWorkflow.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ const ProgressWorkflow = (props) => {
const { content, pathname } = props;
const currentStateKey = content?.review_state;
const dispatch = useDispatch();

const [visible, setVisible] = useState(false);
const [isToolbarOpen, setIsToolbarOpen] = useState(false);
const [workflowProgressSteps, setWorkflowProgressSteps] = useState([]);
Expand Down Expand Up @@ -70,8 +69,10 @@ const ProgressWorkflow = (props) => {
};

setIsToolbarOpen(!!hasToolbar);
// filter out paths that don't have workflow (home, login etc)
// filter out paths that don't have workflow (home, login, dexterity even if the content obj stays the same etc)
if (
content['@id'].indexOf(pathname) >= 0 &&
pathname !== '/' && // wihout this there will be a flicker for going back to home ('/' in included in all api paths)
workflowProgress?.result &&
!workflowProgress.workflow?.error &&
Array.isArray(workflowProgress?.result?.steps)
Expand All @@ -87,10 +88,10 @@ const ProgressWorkflow = (props) => {
setCurrentState(null); // reset current state only if a path without workflow is
// chosen to avoid flicker for those that have workflow
}
}, [currentStateKey, workflowProgress]); // eslint-disable-line
}, [workflowProgress?.result]); // eslint-disable-line

useEffect(() => {
dispatch(getWorkflowProgress(pathname)); // the are paths that don't have workflow (home, login etc)
dispatch(getWorkflowProgress(content['@id'])); // the are paths that don't have workflow (home, login etc)
}, [dispatch, pathname, content]);

// on mount subscribe to mousedown to be able to close on click outside
Expand Down

0 comments on commit f2ce4f0

Please sign in to comment.