refreshPortal
This document assumes you already have a solid understanding of basic Web Development technologies such as JavaScript, React, HTML & CSS.
Refresh Portal Event
The refreshPortal event is essential when dividing the portal into specialized pages, such as a sign-in page or an alternate layout. We recommend you trigger this event whenever the user's location changes to ensure they always have the latest information.
Usage example
window.dispatchEvent(new Event('refreshPortal'));React + Next.js example
This example demonstrates a root-level component that monitors the user's location and triggers the refreshPortal event whenever there is a change. This example is utilising
'use client';
import React from 'react';
import { usePathname } from 'next/navigation';
export const PortalRefreshHandler = ({ children }: { children: React.ReactNode }) => {
const pathname = usePathname();
React.useEffect(() => window.dispatchEvent(new Event('refreshPortal')), [pathname]);
return <>{children}</>;
};
Last updated
Was this helpful?