Search documentation of phoenix_kit

# PhoenixKitWeb.Components.Core.PhoenixKitGlobals (phoenix_kit v1.7.87)

Copy Markdown View Source

Component that sets PhoenixKit JavaScript global variables.

This ensures a single source of truth for all PhoenixKit globals across different layouts (admin, dashboard, root).

## Globals Set

- `window.PHOENIX_KIT_PREFIX` - URL prefix for PhoenixKit routes

## Transport Cache Clearing

Phoenix LiveView caches transport fallback preferences (WebSocket → LongPoll) in browser storage. If WebSocket fails once, the browser permanently uses LongPoll for all subsequent page loads — even after the issue is resolved.

LongPoll causes duplicate LiveView mounts on page refresh due to stale HTTP requests from previous pages completing on the server after navigation.

The inline script clears this cache on every page load so WebSocket is always tried first, providing clean disconnect semantics and preventing double mounts.

## Usage

    <PhoenixKitWeb.Components.Core.PhoenixKitGlobals.phoenix_kit_globals />

## Summary

### Functions

phoenix_kit_globals(assigns)

Renders script tags that set PhoenixKit global variables and clear any cached transport fallback preferences.

## Functions

# phoenix_kit_globals(assigns)

Renders script tags that set PhoenixKit global variables and clear any cached transport fallback preferences.

## Attributes

- Global attributes are accepted.