pglet / pglet-python

Python client for Pglet - build real-time interactive web apps in Python
MIT License
18 stars 7 forks source link

Pglet keeps displaying the same app #33

Closed R-fred closed 2 years ago

R-fred commented 3 years ago

With the pglet server being now included in the python, I noticed that I have to kill the pglet app manually to be able to load a new version of the app. Loading a different page in between also seems to work.

Typical workflow:

  1. write or modify some code in VS Code
  2. Running the code using VS Code run button
  3. Code runs in the VS Code terminal (bash)
  4. Stop code using CTRL + C
  5. Rerun the code after modification using VS Code run button.
aescolastico commented 3 years ago

Sure its not browser cache?

mikaelho commented 2 years ago

I am seeing similar behaviour running a script on replit. Changing code and rerunning the replit does not change what is shown in the browser. I have tried force reloading and cache emptying, both in Safari and Chrome.

But if I run the replit once with local=True, and then again without it, the page refreshes to show the updated content.

FeodorFitsner commented 2 years ago

It's because Pglet server keeps running when the connection between Python client and server is interrupted. Currently, it relies on timeout to determine if the client is disconnected and the page along with its sessions must be destroyed.

We are working on a new version Python client which will be sending "disconnect" message when terminated with CTRL+C.

mikaelho commented 2 years ago

Thank you for the update. That would seem a very useful feature, considering the rapid feedback loop needed for UI development.

Overall, I have high hopes for pglet to finally be the "no pain" rapid Python web development solution we have been missing.

mikaelho commented 2 years ago

On further experimentation, it seems that Stop - Start - Reload (in Replit "browser window") reliably picks up the latest changes, so it does not share the issue with pglet-hosted pages. 👍🏻

R-fred commented 2 years ago

@FeodorFitsner , any timeline for the new pglet-python? I have been looking forward to it for the last 5 months :-)

FeodorFitsner commented 2 years ago

It's been fixed in the latest Python client release.