UI to show that code is compiling in the browser window
Currently, the only way to know that hot code replacement is going to happen (and that the Next.js compiler toolchain is doing work) is to look at the developer console.
Many times, one is looking at the resulting rendering instead, but it's hard to get an idea of progress.
I'd like to make this an umbrella thread for gathering ideas and feedback on how to best signal to the developer that work is happening.
Some requirements:
- The top priority is that it must be non-invasive. Some ideas along these lines
- Favicon animation
-
- The demo works great in Chrome, but not Firefox. I wonder if we can make it work?
-
window.titlechanges- onscreen animation with a shadow root / careful style isolation
- Favicon animation
- It must be unique and identifiable
- It must be very lightweight, even though it will be enabled only during development
Bonus points:
- Like
jest, we can keep data around about how long each unique path takes to compile, to provide statistically accurate estimates when animating of how long the process is going to take
How about something along the lines of a filling triangle ? That way we can keep that brand identity and apply some fun to it.
https://dribbble.com/shots/1894246-Triangle-animation-GIF We could just use a black color fill.
I am sure @evilrabbit could patch something up. :D
@shahzeb1 as I mentioned in the "bonus" portion, we'd have two forms:
- One based in a fixed estimate (let's say 500ms), that slows down at the end if the deadline is not met. This similar to how
nprogressworks. - We can also collect data for better estimates
@stefanivic that sounds nice but I also think having something unique to Next.js could be nice :)
- I think that loading percentage in title is not bad, something like
[10%] title. - Probably it can be loading indicator in top of page.
- Also I was thinking about rotating X (make it like hourglass) in Next.js logo :)
@rauchg Well another thing that comes to mind is the letter N in Next.js
https://i.imgur.com/o567qtv.png As you can see, the N sort of resembles the half of the triangle.
We can maybe create a transition from Zeit logo to N with some simplified animation of this: https://img-9gag-fun.9cache.com/photo/aWZRW82_460sv.mp4
Or just the letter N from scratch.
Is this going to be only for development?
@morajabi yep, as this is only to show webpack compilations going on.
I did animation with zeit logo :)

https://codepen.io/teleginzhenya/pen/PaEzPg
How about using something like triangle from cli-spinners for the title?
I like the way Github does it when you are on a PR site, waiting for the CI to finish (after adding a commit)... just three states: yellow dot for building, green checkmark for done, red x for failed. It's a very subtle design but helpful enough (however it doesn't update sometimes when the tab is inactive in Chrome). Ionic does something similar by changing the color of the favicon from blue (idle) to yellow (building) or red (failed).

Another useful info might be a timestamp of the last successful build (or time since) in the title. But sometimes I pin the tab and only get to see the favicon. On my Macbook (no additional screens) I usually swipe from one desktop (editor) to the next (browser) while waiting for the build.
@simonhaenisch 👍 Although, it's worth mentioning that we still need to show the user favicon after the compilation was done. Am I right?
@morajabi I wouldn’t mind having a next-specific favicon during development, to know that i’m in dev mode on localhost and not in production on my live website. Or one could patch up the user’s favicon with the overlayed icons, but that’s not simple anymore.
Edit: Just saw this tweet by Wes Bos about using canvas to base64 to favicon (as data url). That would make it easy to patch an existing favicon (load it into the canvas, add the overlay icons). Same idea as the mentioned favicon loader.
@simonhaenisch The overlying thing would be really cool 👍 ~if we can make it work at a reasonable cost.~ We can!
I wouldn’t mind having a next-specific favicon during development
Yeah, but I imagine myself wanting to test my own favicon before deploying.
My opinion would be to not completely override the user favicon. If we're going to change, we can change it only while it's compiling. That's easier to do that changing user icon (adding overlay) and it has a decent user experience.
@bennygenel's suggestion re: using ◢ ◣ ◤ ◥ animation before the page title is an option too!
Since we don't have a real estimate of % remaining to complete the build, prepending [24%] to the title doesn't feel right in my opinion (unless we can estimate just close)
I just made a demo of patching an existing favicon: https://patch-favicon-vcxikxushz.now.sh. Works in Chrome and Firefox (Developer Edition) for me (macOS). The icons are not perfectly aligned (it's just some unicode characters rendered as text), but it's a proof that it's possible.
Edit: will try with octicons later (check, dot and x), and might just make it a package. Also found anybar-webpack and webpack-anybar, that's another nice way of doing it.
@simonhaenisch Looks perfect 😍
https://patch-favicon-pxazgxlqkl.now.sh? Should it just go back to normal like 5-10 seconds after a successful build?
Favicon is not shown in Safari unless the address bar is focused which it never is
Is doing a progress line on top like this a bad idea? It's not really intrusive, but the issue is that people might have the same progress bar in their actual app
@rdev
Favicon is not shown in Safari unless the address bar is focused which it never is
Yeah, that's true, for now. Since the Safari coming with Mojave before the fall will show favicons. Also, not showing this loading on Safari, wouldn't break the experience of Next IMO, since we show the status in the CLI currently too.
Is doing a progress line on top like this a bad idea? It's not really intrusive, but the issue is that people might have the same progress bar in their actual app
React Native uses something like this to show the build is running too, so thanks for mentioning it. It might be a bit confusing as It's not uncommon to use NProgress (a top progress bar similar to this one) just how zeit.co is using it now in their app.
@morajabi
Safari coming with Mojave before the fall will show favicons
Are you sure? Cause I'm running Mojave beta and there's no favicon
