π¨ The ultimate agentic social media scheduling tool π€
TypeScript nextjsopen-sourceopen-source-social-media-scheduling-toolosspostiz-cloudpostiz-hostedredisscheduling-toolsocial-media-scheduling-tooltypescript
fix(calendar): open the post tab before the release URL request
Gilad Resisifc5b4ca29f04
diff --git a/apps/frontend/src/components/launches/calendar.tsx b/apps/frontend/src/components/launches/calendar.tsxindex 01d15868d..8aa88aa75 100644--- a/apps/frontend/src/components/launches/calendar.tsx+++ b/apps/frontend/src/components/launches/calendar.tsx@@ -259,16 +259,21 @@ const usePostActions = (onMutate?: () => void) => {const openPost = useCallback((post: Post) => async () => {- const { releaseURL } = await (- await fetch(`/posts/${post.id}/release-url`)- ).json();+ // opened before the request so popup blockers still see the click+ const tab = window.open('', '_blank');+ if (!tab) {+ return;+ }+ tab.opener = null;+ let releaseURL = post.releaseURL;+ try {+ releaseURL =+ (await (await fetch(`/posts/${post.id}/release-url`)).json())+ .releaseURL || releaseURL;+ } catch (e) {}// multi-target posts (several subreddits / communities / channels)// join their URLs with commas: open the first one- window.open(- (releaseURL || post.releaseURL).split(',')[0],- '_blank',- 'noopener,noreferrer'- );+ tab.location.href = releaseURL.split(',')[0];},[fetch]);