Browser preview loading both index page and the current page open in a tab?

I’m working on a website in the editor with the local host browser preview open in another tab. I noticed that the refresh of the browser preview was quite slow (12 - 18 seconds?) after making changes to my site, and then noticed that it appeared IDX was refereshing my home page, and then the page open in my browser tab? (And even then, sometimes multiple times) for a single text change in my editor.

I would have expected that only the page currently open in the browser tab would be hit and refreshed. Is this expected behaviour? Is my site index “open” somewhere in IDX that I don’t know about? (I am not using the small simple browser preview in the editor.)

Some examples of the Astro Docs “getting started” home page being hit one or more times for a single text update in the editor:

And the same pattern is apparent when working on my personal site:

Any suggestions for what might be happening or what I can do would be helpful!

For comparison, here is the Astro Docs on Gitpod. Yes, the page itself sometimes loads multiple times, but never the home page in addition to the page currently open in the browser tab:

This is consistent with the general observation that refreshing previews is up to twice as slow on IDX than it is on Gitpod. It seems IDX is loading twice as many pages each time.

Hm, it’s a great question why we might be hitting / on page reload. One thing that would be helpful is - are you using our preview mechanism, or just starting up the server manually in a terminal? (I assume the former but want to confirm)

We do have something that checks if your server is running but I think we recently stopped it from actually doing a GET for /.

I just tried this out with Astro 5.1, and am seeing only the main page refresh:

  • Basic astro template in IDX with two pages (pages/foo.astro and pages/index.astro)
  • Have a web preview open with the URL /foo
  • Logs screenshot below, from the “IDX” output channel

Since the official Astro docs repo doesn’t have a .idx/dev.nix, I’m assuming you’ve got a local custom environment? Or are you just using the default environment? (I’d love to be able to repro your setup as close as possible to test)