soundstruck

soundstruck

Phoenix: Funky reload behavior with Atom

For some strange reason, when I switch tabs in Atom, or open a file in Atom, it’s causing Phoenix to re-compile assets and reload the page, even when there are no changes to those files.

For example:

click a .vue file tab in Atom:
17:19:37 - info: compiled myfile.vue and 320 cached files into app.js in 636 ms, and the page reloads.

click a .styl file tab in Atom:
17:20:27 - info: compiled myfile.styl and 4 cached files into app.css in 284 ms, and the page reloads.

This is happening without making any edits to those files. It’s not happening with .js files for some reason.

All I have to do is open the file in Atom, OR, click on one of the opened file’s tabs in Atom.

Can anyone who is using Atom confirm?

Me: MacOS, Atom version: 1.23.3

I’ve been using Atom and this was not happening before, so I’m not sure if an Atom update caused it, or if it’s anything that I’ve done. It’s certainly annoying!

Thanks in advance for any insight or suggestions.

p.s. This behavior is not happening in VS Code, so it does seem to be Atom related. I’m just not sure what the relationship between Atom/Phoenix could be to cause it, and I’m not sure where else to troubleshoot it.

Most Liked

josevalim

josevalim

Creator of Elixir

My suggestion would be to disable all plugins and see if the behaviour persists. If it doesn’t, add them back until you see the problem again.

Do you have any plugin that shows which lines are being added/removed from version control directly in the editor? That would be a good starting point.

OvermindDL1

OvermindDL1

That’s, uh, weird… o.O
Did you find it out using package-cop? :slight_smile:

Well git doesn’t write to the file system except on very few calls… Maybe watch what PID’s are opening up on the files? Can always test with another filewatcher and see the specific events that are coming through too?

Hmm, I wonder if the reload is happening on ‘read’ requests too, not just write, that would be odd… Unless… does the Mac OS update the (access) timestamp of a file when it is read?

EDIT: Oh, I bet the status bar is showing git information yes?

OvermindDL1

OvermindDL1

Lol, well this forum has instant updates if the page remains loaded. ^.^

gon782

gon782

If you do switch, be sure to install the excellent Elixir LS extension (GitHub - JakeBecker/vscode-elixir-ls: Elixir language support and debugger for VS Code, powered by ElixirLS. & vscode-elixir - Visual Studio Marketplace) for the live dialyzing and syntax checking experience you probably got used to with Atom (assuming you were already running the LS version in Atom). It’s had a noticeable effect on my development time and efficiency.

Where Next?

Popular in Questions Top

logicmason
Hi there, I'm working through my first release with elixir/phoenix. I've built a release with distillery and found that it crashes when I...
New
Kagamiiiii
Student & New to elixir. Nice language. I want to convert a english character, e.g. “a”, which is stored in a variable, to it’s asci...
New
stefanchrobot
What’s the safe way to decode a JSON string into a struct? I want to avoid calling String.to_atom. Jason.decode can give me a map with st...
New
freewebwithme
Using vs code and installed ElixirLS: support and debugger. And I got an error popped up on start up says Failed to run ‘elixir’ comma...
New
mcarvalho
What is the difference between System.get_env and Application.get_env? For example, what are best practices to use one versus another.
New
chensan
I have a User schema with a :from_id field set to type :string: defmodule TweetBot.Repo.Migrations.CreateUsers do use Ecto.Migration ...
New
rms.mrcs
Hi, I need to transform a list of numbers into a map where the keys are the indexes and the values are the original values of the list....
New
alice
Hey, Just curious what are the main benefits of Elixir compared to Clojure? When is Elixir more useful than Clojure and vice versa? Th...
New
hpopp
To simplify some tasks at work, I wrote and published this package yesterday. It’s a simple macro that enables Access behaviour on struct...
New
wernerlaude
In AR this is so simple @articles = current_user.articles How to do in Ecto? def index(conn, _params) do current_user = conn.assig...
New

Other popular topics Top

Brian
What is the proper way to load a module from a file in to IEX? In the python world, doing something like this pretty standard: from ....
New
bsollish-terakeet
Credo is smart enough to check for (something like) this: assert length(the_list) == 0 with this response: Checking if an enum is empt...
New
gshaw
What is the idiomatic way of matching for not nil in Elixir? E.g., First way: defp halt_if_not_signed_in(conn, signed_in_account) when...
New
aalberti333
As the title describes, I’m trying to run Enum.map() over a list of key/value pairs, where the value is a map. My data looks like this: ...
New
hariharasudhan94
I would like to know what is the best IDE for elixir development?
New
vac
Hi, I'm quite new in Elixir and I'm trying to format a string to a PEM format. I have the certificate value like MIIDBTCCAe2...... and ...
New
minhajuddin
I have seen a lot of code which picks the first element from a list using Enum.at(0) instead of List.first. Is there a reason why people ...
New
johnnyicon
Hi all, I've just started learning Elixir and Phoenix Framework, so please pardon my n00bness at this stage. I'm trying to use Postg...
New
chrisalley
ExUnit now has describe blocks which is a welcome addition coming from RSpec. In the docs, it states that nested hierarchies of describe ...
New
siddhant3030
Hi, I have to write a raw query for one of my project. But till now I have used ecto queries and don’t have much experience writing raw ...
New

We're in Beta

About us Mission Statement