# `PhoenixKitWeb.Components.Core.PhoenixKitGlobals`
[🔗](https://github.com/BeamLabEU/phoenix_kit/blob/v1.7.165/lib/phoenix_kit_web/components/core/phoenix_kit_globals.ex#L1)

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 />

# `phoenix_kit_globals`

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

## Attributes

* Global attributes are accepted.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
