Effect CommunityEC
Effect Community•7mo ago•
32 replies
Maks

Integrating Effect-RX with Tanstack Router's beforeLoad Middleware

Has anyone managed to implement Effect-RX with Tanstack Router's beforeLoad middleware?

export const Route = createFileRoute('/_authenticated')({
  beforeLoad: async ({ location }) => {
    if (!isAuthenticated()) {
      throw redirect({
        to: '/login',
        search: {
          redirect: location.href,
        },
      })
    }
  },
})


Struggling to make it work, because of some weird behaviours , as RX is reactive...

Also cant use RX hooks inside beforeLoad..

Would appreciate a hint 🙂 Thanks!
Was this page helpful?