Reload and Refresh is not commutative #679
Unanswered
hkayabilisim
asked this question in
Q&A
Replies: 2 comments
-
It could be related to #246 |
Beta Was this translation helpful? Give feedback.
0 replies
-
update: I think whenever I save the source code, the reactive variable is actually reinitialized but the the value shown on the web couldn't be updated. The confusing part is that when I make a ui-related change and save, the change is reflected immediately on the browser but the value couldn't. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I don't know if this is already known but I realized that the order of reload and refresh does matter. Let me try to explain:
Reload: refers to the reloading mechanism when the source code is saved (assuming --production is not used)
Refresh: refers to page reload in the browser side usually via Ctrl-R.
The content of a global reactive variable is not same between these two cases:
Reload --> Refresh is not equal to Refresh --> Reload
How to reproduce
Step 1: Save the code to let's say test.py:
Step 2: Run solara
# solara run test.py Solara server is starting at http://localhost:8765
Step 3: Visit http://localhost:8765. You will see a random variable. Keep and eye on this number as you will monitor it in later steps. And also keep your IDE and browser side-by-side.
Step 4: Now in the browser, hit Ctrl-R or whatever shortcut you use to refresh a web page. The initial random number will stay same. You can refresh many times but the number would not change.
Step 5: Now in your IDE or text editor, resave test.py without changing anything. As soon as you save, the timestamp of the source file will change and the web page will refresh automatically. The random number will also stay same. You can repeat saving but the random number wouldn't change.
Step 6: As a last step, now go back to browser and refresh with Ctrl-R. This time the number will change. This is the confusing part because in Step 4, page refreshs were not changing the number.
Beta Was this translation helpful? Give feedback.
All reactions