# `Soundcheck.Check.Refactor.NavigateAcrossLiveSession`
[🔗](https://github.com/leonqadirie/soundcheck/blob/v0.1.0/lib/soundcheck/check/refactor/navigate_across_live_session.ex#L1)

## Basics

> #### This check is disabled by default. {: .neutral}
>
> [Learn how to enable it](`e:credo:config_file.html#checks`) via `.credo.exs`.

This check has a base priority of `low` and works with any version of Elixir.

## Explanation

Flags `push_navigate`, `<.link navigate={...}>`, and `JS.navigate` to
a route in a
different `live_session` than every route of the current LiveView.
LiveView navigates over the socket only within one live_session;
across sessions it falls back to a full page reload, which drops the
socket and reruns the plug pipeline and both mounts.

Before:

    # in MyAppWeb.HomeLive, in live_session :public
    <.link navigate={~p"/admin"}>Admin</.link>

After, when the reload is intended:

    <.link href={~p"/admin"}>Admin</.link>

Or move both routes into one live_session when they share their
`on_mount` hooks and layout.

Only literal paths and `~p` sigils are checked. Interpolated segments
match any route segment; the check reports only when every matching
route sits in another session. `ignore_sessions` lists session names
to skip as origin or target.

Confidence: low. Tier: semantic (run `mix compile` before `mix credo`).

## Check-Specific Parameters

Use the following parameters to configure this check:

### `:excluded_paths`

  Paths to skip (atoms, binaries as path segments, or regexes).

*This parameter defaults to* `[~r/\/test\//, "test"]`.

### `:strict`

  Unused.

*This parameter defaults to* `false`.

### `:ignore_sessions`

  live_session names (atoms) to skip as origin or target.

*This parameter defaults to* `[]`.

## General Parameters

Like with all checks, [general params](`e:credo:check_params.html`) can be applied.

Parameters can be configured via the [`.credo.exs` config file](`e:credo:config_file.html`).

---

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