# Reload confirmation dialog for an incorrect scenario

**URL:** https://forum.pinegrow.com/t/reload-confirmation-dialog-for-an-incorrect-scenario/4460
**Category:** Bug Reports
**Created:** [August 22, 2020, 2:45pm UTC](https://forum.pinegrow.com/t/reload-confirmation-dialog-for-an-incorrect-scenario/4460 "2020-08-22T14:45:51Z")
**Posts on this page:** 17
**Page:** 1

<div class="post-metadata">

### Author: ![TechAkayy](https://avatars.discourse-cdn.com/v4/letter/t/ce73a5/32.png) [@TechAkayy](https://forum.pinegrow.com/u/TechAkayy)
#### Post date: [August 22, 2020, 2:45pm UTC](https://forum.pinegrow.com/t/reload-confirmation-dialog-for-an-incorrect-scenario/4460/1 "2020-08-22T14:45:51Z")

</div>

I have a script on my page, that triggers a reload of the page on receiving a websocket signal.

And pinegrow keeps popping up this confirmation message in spite of the fact that the page wasn’t edited (notice no asterik next to the file name index.html).

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/pinegrow/original/2X/0/0434ba3ed67ce7049d3ed80fa5370ffff58b9a68.png)

This has been hitting me all day and I see no way to overcome this. It makes sense to show this if index.html page was edited and requires a save…

Is this yet another internal server based limitation? 😥 I need javascript switched on!

---

<div class="post-metadata">

### Author: ![TechAkayy](https://avatars.discourse-cdn.com/v4/letter/t/ce73a5/32.png) [@TechAkayy](https://forum.pinegrow.com/u/TechAkayy)
#### Post date: [August 22, 2020, 3:03pm UTC](https://forum.pinegrow.com/t/reload-confirmation-dialog-for-an-incorrect-scenario/4460/2 "2020-08-22T15:03:31Z")

</div>

In fact, I have noticed, refresh of an edited html page (with an asterik on the filename), doesn’t actually show any such confirmation message, this is when it’s more important to show a confirmation dialog.

 ![2020-08-23 01.05.18](https://canada1.discourse-cdn.com/flex036/uploads/pinegrow/original/2X/9/9eb8c182304b423097ddf0f05b5268ac2b471857.gif)

I have never got the “reload site” message from any UI actions. This shouldn’t be shown especially when it’s unnecessary (when the page is in an unedited state)!

---

<div class="post-metadata">

### Author: ![droidgoo](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.pinegrow.com/droidgoo/32/2209_2.png) [@droidgoo](https://forum.pinegrow.com/u/droidgoo)
#### Post date: [August 22, 2020, 3:45pm UTC](https://forum.pinegrow.com/t/reload-confirmation-dialog-for-an-incorrect-scenario/4460/3 "2020-08-22T15:45:31Z")

</div>

just a wild shot in the dark, but do you have the “remember collapsed status” thingy on?

what ever else that routine does, it will write to the file and not show an asterisk indication of a change.

---

<div class="post-metadata">

### Author: ![TechAkayy](https://avatars.discourse-cdn.com/v4/letter/t/ce73a5/32.png) [@TechAkayy](https://forum.pinegrow.com/u/TechAkayy)
#### Post date: [August 23, 2020, 12:58am UTC](https://forum.pinegrow.com/t/reload-confirmation-dialog-for-an-incorrect-scenario/4460/4 "2020-08-23T00:58:00Z")

</div>

Thanks for the suggestion mate. I tried it, no luck, same issue…

---

<div class="post-metadata">

### Author: ![red-rosefields](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.pinegrow.com/red-rosefields/32/5392_2.png) [@red-rosefields](https://forum.pinegrow.com/u/red-rosefields)
#### Post date: [August 23, 2020, 12:54pm UTC](https://forum.pinegrow.com/t/reload-confirmation-dialog-for-an-incorrect-scenario/4460/5 "2020-08-23T12:54:32Z")

</div>

Do you have VS opened? Sometimes it does not play nice with pg.

---

<div class="post-metadata">

### Author: ![droidgoo](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.pinegrow.com/droidgoo/32/2209_2.png) [@droidgoo](https://forum.pinegrow.com/u/droidgoo)
#### Post date: [August 23, 2020, 5:38pm UTC](https://forum.pinegrow.com/t/reload-confirmation-dialog-for-an-incorrect-scenario/4460/6 "2020-08-23T17:38:26Z")

</div>

can confirm… tho it seems more related to PG behavior than VS code, in my case.

always worth severing that connection to track down unwanted/odd behavior.

---

<div class="post-metadata">

### Author: ![TechAkayy](https://avatars.discourse-cdn.com/v4/letter/t/ce73a5/32.png) [@TechAkayy](https://forum.pinegrow.com/u/TechAkayy)
#### Post date: [August 23, 2020, 11:30pm UTC](https://forum.pinegrow.com/t/reload-confirmation-dialog-for-an-incorrect-scenario/4460/7 "2020-08-23T23:30:32Z")

</div>

Thanks @red-rosefields & @droidgoo, I removed the vs-code pg extension, restarted both vs-code & pinegrow, didn’t fix it…

Going by pinegrow’s philosophy that we are not locked-into pinegrow and we can work on pinegrow alongside other tools like vs-code…

… I don’t see any use-case scenario where this dialog (“Reload site”) can be shown except when we quit pinegrow and there are unsaved open files (with an asterisk next to the filename). Even then, this dialog can’t be “Reload site”, as it’s only to do with unsaved open files.

Hopefully, the pinegrow pro team can assist here. Cheers!

This gif from this page pretty much explains how it’s suppose to work (not talking about instant live update for eg, with vscode pg plugin, rather auto-refresh on save):

> **[Other code editors and IDEs | Pinegrow Web Editor](https://docs.pinegrow.com/docs/master-pinegrow/using-external-code-editors/other-code-editors-and-ides/)**
>
> Pinegrow can be used with any external code editor. It detects when a file is saved outside of Pinegrow and then refreshes modified parts.

 ![edit.code_.modal_1](https://canada1.discourse-cdn.com/flex036/uploads/pinegrow/original/2X/9/957b4aa392358908e901b3e9d4e5b3bd950425de.gif)

---

<div class="post-metadata">

### Author: ![RobM](https://avatars.discourse-cdn.com/v4/letter/r/278dde/32.png) [@RobM](https://forum.pinegrow.com/u/RobM)
#### Post date: [August 24, 2020, 10:04am UTC](https://forum.pinegrow.com/t/reload-confirmation-dialog-for-an-incorrect-scenario/4460/8 "2020-08-24T10:04:36Z")

</div>

This question is a little bit of a black box. Can you share the script that is causing the original problem? Typically a reload will not lose any edits that have been made to the page, hence the lack of notification.

---

<div class="post-metadata">

### Author: ![TechAkayy](https://avatars.discourse-cdn.com/v4/letter/t/ce73a5/32.png) [@TechAkayy](https://forum.pinegrow.com/u/TechAkayy)
#### Post date: [August 24, 2020, 11:35am UTC](https://forum.pinegrow.com/t/reload-confirmation-dialog-for-an-incorrect-scenario/4460/9 "2020-08-24T11:35:57Z")

</div>

Hi @RobM,

Thanks for looking into this. Here is a simple replication of the issue, click button to reload.

In my real app, I trigger reload when I receive socket updates for certain events (on an avg every minute). And I’m forced to deal with this dialog every minute while I’m working on a live site.

```auto
<!DOCTYPE html>
<html>
  <head> </head>
  <body>
    <p>location.reload function</p>
    <button onclick="sampleFunction()">Reload the page!</button>

    <script>
      function sampleFunction() {
        location.reload()
      }
    </script>
  </body>
</html>

```

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/pinegrow/original/2X/1/18a93fff12a4f48d9974952b4e0af82dbb1011ff.png)

---

<div class="post-metadata">

### Author: ![RobM](https://avatars.discourse-cdn.com/v4/letter/r/278dde/32.png) [@RobM](https://forum.pinegrow.com/u/RobM)
#### Post date: [August 24, 2020, 3:27pm UTC](https://forum.pinegrow.com/t/reload-confirmation-dialog-for-an-incorrect-scenario/4460/10 "2020-08-24T15:27:47Z")

</div>

Hmmm… what changes are happening on the site in the intervening minute? Your example above doesn’t trigger the dialog. Usually this type of warning only pops up if there is user input that would be lost on reset. Normally other changes should be cached and persist through a reload.

---

<div class="post-metadata">

### Author: ![Pinegrow\_User](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.pinegrow.com/pinegrow_user/32/4919_2.png) [@Pinegrow\_User](https://forum.pinegrow.com/u/Pinegrow_User)
#### Post date: [August 24, 2020, 4:18pm UTC](https://forum.pinegrow.com/t/reload-confirmation-dialog-for-an-incorrect-scenario/4460/11 "2020-08-24T16:18:07Z")

</div>

> [@RobM](#):
>
> Your example above doesn’t trigger the dialog.

It does when you make active both “Test Clicks” + “Enable JS”.

Is that what you are speaking of @TechAkayy?

 ![Test-Clicks-+-Enable-JSfor Page](https://canada1.discourse-cdn.com/flex036/uploads/pinegrow/original/2X/2/27c4d99ee61f345faa9cf9f9be43bdcf838a51de.png)

---

<div class="post-metadata">

### Author: ![RobM](https://avatars.discourse-cdn.com/v4/letter/r/278dde/32.png) [@RobM](https://forum.pinegrow.com/u/RobM)
#### Post date: [August 24, 2020, 4:39pm UTC](https://forum.pinegrow.com/t/reload-confirmation-dialog-for-an-incorrect-scenario/4460/12 "2020-08-24T16:39:22Z")

</div>

@Pinegrow_User and @TechAkayy

[https://canada1.discourse-cdn.com/flex036/uploads/pinegrow/original/2X/c/c95763b1f82382e2d95724ec3e9a0e438b5e5611.mp4](https://canada1.discourse-cdn.com/flex036/uploads/pinegrow/original/2X/c/c95763b1f82382e2d95724ec3e9a0e438b5e5611.mp4)

I’m running on a Mac - what OS are you running?

---

<div class="post-metadata">

### Author: ![TechAkayy](https://avatars.discourse-cdn.com/v4/letter/t/ce73a5/32.png) [@TechAkayy](https://forum.pinegrow.com/u/TechAkayy)
#### Post date: [August 24, 2020, 10:01pm UTC](https://forum.pinegrow.com/t/reload-confirmation-dialog-for-an-incorrect-scenario/4460/13 "2020-08-24T22:01:24Z")

</div>

Hi @RobM, Im running macOS Catalina v10.15.3, PG 5.972.

Please see gif attached, it shows my PG settings also. I did have the vs-code extension installed earlier and had my project open in vs-code, but I removed the extension and closed vs-code (not sure if it matters).

 ![2020-08-25 07.52.19](https://canada1.discourse-cdn.com/flex036/uploads/pinegrow/original/2X/b/b7d1a3421f51f1175c4e7e2a4cf9609a5760d364.gif)

Another way to approach this issue, if you could find out when this dialog in PG workflow is shown functionally, and I could then do some trial and error by changing the settings to avoid this dialog.

Happy to provide any other info as required.

---

<div class="post-metadata">

### Author: ![TechAkayy](https://avatars.discourse-cdn.com/v4/letter/t/ce73a5/32.png) [@TechAkayy](https://forum.pinegrow.com/u/TechAkayy)
#### Post date: [August 24, 2020, 10:16pm UTC](https://forum.pinegrow.com/t/reload-confirmation-dialog-for-an-incorrect-scenario/4460/14 "2020-08-24T22:16:25Z")

</div>

> [@Pinegrow\_User](#):
>
> It does when you make active both “Test Clicks” + “Enable JS”.

That’s correct @Pinegrow_User, I’m clicking the button with JS & Test clicks enabled!

Thanks for checking it at your end.

---

<div class="post-metadata">

### Author: ![RobM](https://avatars.discourse-cdn.com/v4/letter/r/278dde/32.png) [@RobM](https://forum.pinegrow.com/u/RobM)
#### Post date: [August 25, 2020, 10:13am UTC](https://forum.pinegrow.com/t/reload-confirmation-dialog-for-an-incorrect-scenario/4460/15 "2020-08-25T10:13:30Z")

</div>

As my post above shows, the dialog wasn’t popping up for me. That was when I just opened a file and added your code. Given that @Pinegrow_User and you were able to trigger it, I tried saving the file and opening as a project. Now the dialog triggers. That dialog seems to be a lower level NW.js dialog. I’m not sure if much can be done to stop it from appearing. I think you will have to temporarily disable that bit of javascript when working in Pinegrow.

---

<div class="post-metadata">

### Author: ![TechAkayy](https://avatars.discourse-cdn.com/v4/letter/t/ce73a5/32.png) [@TechAkayy](https://forum.pinegrow.com/u/TechAkayy)
#### Post date: [August 25, 2020, 12:16pm UTC](https://forum.pinegrow.com/t/reload-confirmation-dialog-for-an-incorrect-scenario/4460/16 "2020-08-25T12:16:39Z")

</div>

Thanks @RobM for the confirmation that it’s not in pinegrow’s control, the nice pinegrow logo in the confirmation dialog deceived me…

got me to research more on it, and I can’t believe, it is a real browser thing -

> <https://stackoverflow.com/questions/55587025/how-to-disable-a-reload-site-changes-you-made-may-not-be-saved-popup-for-pyt/55590017#55590017>

I had to fix my reload function… for anyone else hitting this block:

```auto
      function reload() {
		  window.onbeforeunload = null
		  window.location.reload()
      }

```

Not sure what couldn’t be the side-effects of the additional line “window.onbeforeunload=null”, will take it as it comes…

@RobM, it’s still a mystery why you didn’t get the same dialog… for another time…

---

<div class="post-metadata">

### Author: ![RobM](https://avatars.discourse-cdn.com/v4/letter/r/278dde/32.png) [@RobM](https://forum.pinegrow.com/u/RobM)
#### Post date: [August 25, 2020, 12:57pm UTC](https://forum.pinegrow.com/t/reload-confirmation-dialog-for-an-incorrect-scenario/4460/17 "2020-08-25T12:57:30Z")

</div>

@TechAkayy Good find! You might have missed it above, but I DID get the dialog once the page was opened in a project, not outside of a project.
