Debugging and Code Reloading

I am using phoenix and want to play around with phoenix_html package. So, my first question is

  • How do I set a breakpoint to test its function Phoenix.HTML.Form.inputs_for/3 ? I know there is break! but how do I use it?

  • After updating the code in the package, I need to recompile them using mix deps.compile, is there a way to automate the compilation process?

I haven’t used break! function yet, but have you tried break!(Phoenix.HTML.Form, :inputs_for, 3)?

Have you tried phoenix_live_reload?

Hi hauleth,
English is not my first language so please bear with me :slight_smile:

Lets say u were working on a phoenix project and you wanted to test a package,(phoenix_live_view). How would u do it? How would you set a break point where you can pry its content?

And If I were to make changes in lets say phoenix_live_view, phoenix_live_reload wont be able to catch that change. I have to manually run mix deps.compile phoenix_live_view and run mix phx.server, so how to watch for changes in deps folder and automatically compile?

As I said, I have no experience with break! but it takes 3 arguments:

  • module name
  • function name
  • function arity

So you need that three values to break into function. I do not know what more do you expect from me. Just read the documentation.

You cannot safely add dependencies or change configuration of the project and reload the modules, that is why if such thing happen then phoenix_live_reload will fail and will tell you to restart application. These reasons are:

  • values from configuration can be used during compilation, so changing configuration can require recompilation of dependencies
  • change in dependencies can require recompilation of other dependencies, as Mix allow for optional dependencies
1 Like