Redirection issue

const useAppRedirect = () => {
  try{
    const host = new URLSearchParams(window.location.search).get('host') || 'localhost';
    const app = createApp({
      apiKey: process.env.NEXT_PUBLIC_SHOPIFY_API_KEY || '',
      host,
      forceRedirect: true,
    });
    const redirectTo = (url: string) => {
      const redirect = Redirect.create(app);
      redirect.dispatch(Redirect.Action.APP, url);
    };
    return redirectTo;
  } catch (error) {
    console.error('Error creating app:', error);
    return (url: string) => { console.log('Redirect not available in server component', error); };
  }
};

The issue we have now is that doing a dispatch to redirect using the Action.APP does not register the first event for redirection this causes an issue on the frontend where the user is stuck waiting for navigation, and has to repeat the same action again to get the navigation.

Can someone help?

Hey @blync_ai,

could you share which version of App Bridge you are using? This looks like the legacy App Bridge from npm, is that correct?

Kevin :hatching_chick: