Reload confirmation dialog for an incorrect scenario

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).

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? :disappointed_relieved: I need javascript switched on!

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.

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)!

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.

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

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

1 Like

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.

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):

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.

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.

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

      function sampleFunction() {

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.

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

Is that what you are speaking of @Akayy?

@Pinegrow_User and @Akayy

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

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).

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.

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

Thanks for checking it at your end.

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.

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 -

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

      function reload() {
		  window.onbeforeunload = null

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…

1 Like

@Akayy 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.

1 Like