diff --git a/src/discussions/discussions-home/DiscussionsHome.jsx b/src/discussions/discussions-home/DiscussionsHome.jsx index 0db64ffe..2ae61262 100644 --- a/src/discussions/discussions-home/DiscussionsHome.jsx +++ b/src/discussions/discussions-home/DiscussionsHome.jsx @@ -55,10 +55,11 @@ export default function DiscussionsHome() { // stored in redirectToThread if (redirectToThread) { dispatch(clearRedirect()); - history.push(discussionsPath(Routes.COMMENTS.PAGES['my-posts'], { + const newLocation = discussionsPath(Routes.COMMENTS.PAGES['my-posts'], { courseId, postId: redirectToThread.threadId, - })); + })(location); + history.push(newLocation); } }, [redirectToThread]); @@ -98,7 +99,13 @@ export default function DiscussionsHome() { - +
{ if (editExisting) { - history.push(discussionsPath(commentsPagePath, { + const newLocation = discussionsPath(commentsPagePath, { courseId, topicId, postId, - })); + })(location); + history.push(newLocation); } dispatch(hidePostEditor()); }; diff --git a/src/discussions/posts/post/Post.jsx b/src/discussions/posts/post/Post.jsx index 5eee92fc..7514d59d 100644 --- a/src/discussions/posts/post/Post.jsx +++ b/src/discussions/posts/post/Post.jsx @@ -28,7 +28,7 @@ function Post({ const topic = useSelector(selectTopic(post.topicId)); const topicContext = useSelector(selectTopicContext(post.topicId)); const actionHandlers = { - [ContentActions.EDIT_CONTENT]: () => history.push(`${location.pathname}/edit`), + [ContentActions.EDIT_CONTENT]: () => history.push({ ...location, pathname: `${location.pathname}/edit` }), // TODO: Add flow to confirm before deleting [ContentActions.DELETE]: () => dispatch(removeThread(post.id)), [ContentActions.CLOSE]: () => dispatch(updateExistingThread(post.id, { closed: !post.closed })),