Skip to content

Update to Phoenix LiveView 1.0 #128

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jakedjohnson
Copy link

@jakedjohnson jakedjohnson commented Apr 28, 2025

Upgrade LiveView to 1.0

This PR updates LiveAdmin to work with Phoenix LiveView 1.0.

What changed:

  • Updated dependencies (phoenix_live_view, floki, and related packages).
  • Handled deprecation warnings after the update:
    • Adjusted Gettext usage.
    • Replaced deprecated tuple operation.
    • Updated navigation helpers for Phoenix 1.0.
    • Migrated template syntax from <%= ... %> to {...}.

Why:

  • Keeps LiveAdmin compatible with newer versions of Phoenix and LiveView.
  • Eliminating compiler warnings feels good.

Notes:

  • No breaking changes expected beyond the usual LiveView 1.0 migration adjustments.

This commit updates the application to work with Phoenix LiveView 1.0, including several API changes and syntax updates:

1. Dependency Updates:
   - Changed phoenix_live_view from ">=0.20.0 and <0.21.0" to "~> 1.0.0"
   - Updated floki to "~> 0.36.0"
   - Multiple dependency version updates in mix.lock

2. API Changes:
   - Updated Gettext usage from `use Gettext` to `use Gettext.Backend`
   - Changed `Tuple.append` to `Tuple.insert_at` with explicit size parameter
   - Replaced all instances of `push_redirect` with `push_navigate` to align with LiveView 1.0 API

3. Template Syntax Changes:
   - Updated template interpolation syntax throughout components
   - Changed from ERB-style `<%= ... %>` to the more concise `{...}` format
   - Updated in container, nav, and resource components
Copy link
Owner

@tfwright tfwright left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! There are a couple of changes that don't look necessarily related to the LV upgrade. If so, I would prefer to break them out into a separate PR (or at least separate commits in this PR). If you do that I will test it out a bit more and then merge.

@@ -1,5 +1,5 @@
defmodule Demo.Gettext do
use Gettext, otp_app: :demo, priv: "dev/gettext"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The gettext dep is not changed in this PR. Are you sure this warning is new to LV 1.0?

@@ -111,7 +111,7 @@ defmodule LiveAdmin do
with result = {_, m, f, _} <-
extract_function_from_config(resource, session, function_type, function),
docs when is_map(docs) <- extract_function_docs(m, f) do
Tuple.append(result, docs)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This must be related to Elixir rather than Phoenix version?

@github-actions github-actions bot added the Stale label May 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants