Phoenix v1.5.0 released!

You can use view_module(conn) and view_template(conn) to access these values from the template.

2 Likes

Note you will have to import view_template: 1 in your my_app_web.ex file under the def view section.

2 Likes

Super great, without your suggested this site, the migrate guide hardly work.

Here is a list of trick I encountered:

  • install 1.5.1 instead of 1.5.0 in gist
  • don’t change fetch_live_fresh to fetch_fresh
  • font size really small now
  • dashboard not working

After I changed to

<%= @inner_content %>

giving this error:

assign @page_index not available in eex template.

How to pass those assign now?

Thats interesting.
I can see from reviewing

@spec view_module(Plug.Conn.t) :: atom
def view_module(conn) do
  conn.private.phoenix_view
end

that view_module is already looking at the conn’s private to get at the same value I was pattern matching on. So how is it there is not a conflict with the assigns value of @view_module I would have assumed thats where the assigns got its value from in the first place?

Also how do you feel about the naming now that view_module(conn) returns a different value than of the assigns @view_module ? Not that its a big deal, but the naming kind of tickles my OCD.

I have deprecated @view_module in master, exactly because of this reason, so your OCD can thank me once v1.6 is out. :slight_smile:

7 Likes

Is there any way possible

summary(“http.request.stop.duration”, unit: {:native, :millisecond})

to get more stats like this? or where I can read more of http events to summarize in live dashboard?
such as

http.request.stop.duration

http.request.post.time???

Hey,
The LiveDashboard is very awesome, it makes me add more instrumentation to the code. Thank you guys!

I was wondering if there is a way to configure the socket path for live_dashboard?

It is supported on the dashboard master. It can be done by passing :live_socket_path to the live_dashboard router call.

3 Likes

Thanks for adding it, Jose!

Hi @chrismccord, congrats on the new release! :slightly_smiling_face:

Just noticed today after upgrading to 1.5 that the new generators will have a mix setup task.
At least, according to PhoenixDiff, it seems that way…
I left a note in the guide’s gist because npm install --prefix assets doesn’t seem to work properly on Windows.

I know you are already aware of this issue because of this comment. So, I wanted to ask if there’s anything that can be done besides running it manually and if not, could we at least document it in the generated project’s README? I think requiring mix setup to be run could be misleading in that case.

PS.: I’ve tested with both Node LTS and current, it simply doesn’t work.

Also thanks @axelson for the phoenix diff tip :smile:.

1 Like

Does changing your setup alias to the following work for you?

      setup: ["deps.get", "cmd 'cd assets && npm install'"],

if so maybe that should be the default.

@wojtekmach This is valid CMD but does not work in Powershell (only in newer versions that does not ship with Windows 10 by default). Check this for a better explanation.

I’ve also tested using setup: ["deps.get", "cmd cd assets", "cmd npm install"] but it freezes my terminal every single time for some reason.

Are you aware of a one-liner that would npm install in a portable way across OSes?

I’ve also tested using setup: ["deps.get", "cmd cd assets", "cmd npm install"]

I believe each command is running in subshell so the directory change doesn’t persist.

I’m researching what are the options. I’ve tested

Interestingly enough, since the npm repository was moved to https://github.com/npm/cli; there’s no trace of this problem being discussed, even though the old archived repository has open issues about that :man_shrugging:. I’m not sure wether this is a regression or if it was even fixed at some point.

I’ve got a problem creating a release using Docker, maybe someone can help?
I’m using the Dockerfile from https://hexdocs.pm/phoenix/releases.html#containers
Everything seems fine until it fails short time before finish with following message:

Step 23/26 : COPY --from=build --chown=nobody:nobody /app/_build/prod/rel/my_app ./
COPY failed: stat /var/lib/docker/overlay2/eb170e088a8c087d23f677f13e3f832062014759af8564efe30c4292656da00a/merged/app/_build/prod/rel/my_app: no such file or directory

You probably need to change the name of the file to match the name of your release in that line.

1 Like

Oh man, thx :smiley:
Of course, how could I’ve been so blind, that happens when doing things late at night :smiley:
Working now :stuck_out_tongue:

/edit:
Works fine on Linux, however on Windows I run into the same issue as others here:

Step 14/26 : RUN npm run --prefix ./assets deploy
 ---> Running in 866f8ef90270

> @ deploy /app/assets
> webpack --mode production

/app/assets/node_modules/.bin/webpack: line 1: XSym: not found
/app/assets/node_modules/.bin/webpack: line 2: 0025: not found
/app/assets/node_modules/.bin/webpack: line 3: 04ec15c01fc3c268b6405aedcd29653e: not found
/app/assets/node_modules/.bin/webpack: line 4: ../webpack/bin/webpack.js: not found

npm run --prefix assets does not work on Windows. If you do something like cd assets && npm run deploy then it should be good to go.

1 Like

Thanks for the reply. I’ve tried this already as I’ve seen this suggestion somewhere else, but it does not seem to work for me, the result is the same.
However, it’s not critical for me as I’m working mainly with Linux, it’s just a bit sad :wink:

Thanks for all your work :+1:t3: