pfun

pfun

Using 1.7.0-rc.0 for some experiments and it quickly became obvious that while code reloading is working as usual in lib/<appname>_web and elsewhere in the app, it is not working in lib/<appname>. This is a vanilla/out of the box application. I added phx.gen.auth to have some more code to edit that really should cause a reload.

I have tried this with a couple different versions of Elixir and Erlang. I tried going back to 1.6 and confirmed it’s working fine there. Finally, I used a different laptop (tested MacOS 12.4 and 12.6) and the same thing was observed.

Anyone else seen this? Third-party confirmation would be appreciated as well!

Showing Posts 1 to 10

derpycoder

derpycoder

Try mix deps.compile file_system

It fixed the issue with live reload, for me, after I updated both Mac and Phoenix.

pfun

pfun OP

Unfortunately this had no effect. On the second machine I tried this on there was no elixir (or really any devtools at all) beforehand. Completely clean install of erlang/elixir/phoenix 1.7 rc0

Worth clarifying, also, that I’m not talking about ‘live reload’, but just basic code reloading like editing the generated user.ex from phx.gen.auth. Changing the code does not cause the server to reload this code so it just keeps running the old version (e.g. add require Logger and Logger.error("TEST") to user.ex while the server is running, and you will not see the log (or at least, I don’t).

kokolegorille

kokolegorille

You might check the live reload patterns in config/dev.exs ans adjust them…

This post might be helpful.

pfun

pfun OP

Thanks but again that is for live reload, when I’m talking about just basic code reloading. As in the Phoenix server knowing that you edited an elixir file and using the new version. Nothing at all to do with browser reloading :frowning:

pfun

pfun OP

If anyone would like to try to reproduce:

mix archive.install hex phx_new 1.7.0-rc.0
mix phx.new testapp && cd testapp
mix phx.gen.auth Accounts User users
mix deps.get && mix ecto.create && mix ecto.migrate
mix phx.server

Go to register a user and put in only 4 chars for password, say. You get a validation error as expected. Now go to lib/testapp/accounts/user.ex and add to validate_email function or similar, something like:

require Logger
Logger.error("\n\n\n*******************\nTESTING\n*************\n\n\n")

Hit submit button again in browser. I do not see my new log. Change text of log, hit button again – still no log. Restart the server and try again, log appears! Edit the log message again, hit button again, log text does not change.

babouinette

babouinette

I can say I have the same problem :smiley:

pfun

pfun OP

Well that’s… ‘good’? :sweat_smile:
Thanks for confirming!

beepbeepbopbop

beepbeepbopbop

Can you clarify whether or not you are using LiveView based authentication system? When you run mix phx.gen.auth Accounts User users, you are given the prompt:

An authentication system can be created in two different ways:
- Using Phoenix.LiveView (default)
- Using Phoenix.Controller only
Do you want to create a LiveVIew based authentication system? [Yn]

I can only assume that you are using LiveView and if that’s the case, I think I know why your changes to your user.ex file aren’t being reflected. If you check endpoint.ex, you can see that plug Phoenix.CodeReloader is specified. So every request to your dev server goes through this plug and runs Phoenix.CodeReloader.reload(ExampleWeb.Endpoint) for you. If you were to make your logger change and reload the page, this ought to work and your change honoured.

Now, this doesn’t work with LiveView since they are process based. Once your LiveView connection is mounted (as in your LV has successfully mounted in both calls), all changes will be pushed to the LV, and won’t go through the Phoenix.CodeReloader. You would need to update something your web directory, or run recompile in your iex session.

I am not absolutely sure that this is the case, but give it a go without LV and see if you can replicate the issue you have.

Rugged

Rugged

Did you lodge a git issue, as I think this would be good to have fixed before final release.

I couldn’t see it here, but maybe its already closed.

pfun

pfun OP

Yea, this is an interesting point. It is a liveview auth system. However having worked with liveview before I’ve never had a code reloading problem like this. I’m going to try it with a non-live auth right now – uno momento.

Sadly an out-of-the-box non-liveview auth system seems to fail on the register page with no "new" html template defined for TestappWeb.UserRegistrationHTML (similar for the login page).

Anyway, simply the fact that you see stuff like:

Rebuilding...
Done in 48ms.

when editing in <appname>_web and not in <appname> seems like a problem to me.

@Rugged yea I had considered doing that right off the bat, but also I tend to assume it’s me doing something wrong by default :laughing: were you able to confirm this behaviour yourself by any chance?

Where Next? Top

Trending in Questions Top

RSP87
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
nseaSeb
Hello, I know there is an approach for handling lists that allows for optimized traversal, but I can’t recall the specific method (somet...
New
kpanic
Hi everyone, I am toying with the idea of building a “match maker” for giving personal help to people that wants to start coding. I sta...
New
brecabral
Documentation While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
velrest
So my question is quite simple and i have found no conclusive answer on forum, google or AI. Should we use :erlang.float for Integer to ...
New
asweet-confluent
I recently noticed that Elixir’s Logger defaults its primary log level to :debug when no :logger, :level application configuration is pre...
New
apz
I’m new to elixir and just tried to install the elixirLS extension for VScode(ium) and it is throwing some errors that I would like help ...
New

Other Trending Topics Top

GenericJam
Edit: 2026 May 15 - This post is archived. Mob is alive!! Main docs: mob v0.7.11 — Documentation A bit of explanation for the slightly c...
New
JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
New
mhanberg
Hi everyone! The first release candidate for the Expert language server project is now available! We’ve published a press release detai...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews