@@ -24,21 +24,22 @@ import { SchedulePostModal } from '~/components/Post/EditV2/SchedulePostModal';
24
24
import { usePostContestCollectionDetails } from '~/components/Post/post.utils' ;
25
25
import { ShareButton } from '~/components/ShareButton/ShareButton' ;
26
26
import { useCatchNavigation } from '~/hooks/useCatchNavigation' ;
27
- import { useCurrentUser } from '~/hooks/useCurrentUser' ;
27
+ // import { useCurrentUser } from '~/hooks/useCurrentUser';
28
28
import { useTourContext } from '~/components/Tours/ToursProvider' ;
29
29
import { PostDetailEditable } from '~/server/services/post.service' ;
30
30
import { CollectionType } from '~/shared/utils/prisma/enums' ;
31
31
import { formatDate } from '~/utils/date-helpers' ;
32
32
import { showErrorNotification } from '~/utils/notifications' ;
33
33
import { trpc } from '~/utils/trpc' ;
34
34
import { useFeatureFlags } from '~/providers/FeatureFlagsProvider' ;
35
+ import { removeEmpty } from '~/utils/object-helpers' ;
35
36
36
37
export function PostEditSidebar ( { post } : { post : PostDetailEditable } ) {
37
38
// #region [state]
38
39
const queryUtils = trpc . useUtils ( ) ;
39
40
const router = useRouter ( ) ;
40
41
const params = usePostEditParams ( ) ;
41
- const currentUser = useCurrentUser ( ) ;
42
+ // const currentUser = useCurrentUser();
42
43
const { runTour } = useTourContext ( ) ;
43
44
const features = useFeatureFlags ( ) ;
44
45
@@ -92,9 +93,9 @@ export function PostEditSidebar({ post }: { post: PostDetailEditable }) {
92
93
} ) ;
93
94
if ( publishedAt && afterPublish ) await afterPublish ( { postId : id , publishedAt } ) ;
94
95
else {
95
- // router.push({ pathname: `/posts/${post.id}`, query: removeEmpty({ returnUrl }) });
96
96
if ( returnUrl ) router . push ( returnUrl ) ;
97
- else router . push ( `/user/${ currentUser ?. username } /posts` ) ;
97
+ else router . push ( { pathname : `/posts/${ post . id } ` , query : removeEmpty ( { returnUrl } ) } ) ;
98
+ // else router.push(`/user/${currentUser?.username}/posts`);
98
99
}
99
100
await queryUtils . image . getImagesAsPostsInfinite . invalidate ( ) ;
100
101
} ,
0 commit comments