Repository: streamlit/streamlit

Issue:
ChunkLoadError
# Summary
Error shown when upgrading from 0.45 to 0.46.

# Steps to reproduce
On 0.45:
```
pip install --upgrade streamlit opencv-python altair
streamlit run https://raw.githubusercontent.com/streamlit/demo-self-driving/master/app.py
```
Then, upgrade to 0.46:
```
pip install --upgrade streamlit opencv-python altair
streamlit run https://raw.githubusercontent.com/streamlit/demo-self-driving/master/app.py
```
Do not refresh the client.

## Expected behavior:
No bug

## Actual behavior:
See screenshot.
![image](https://user-images.githubusercontent.com/6821233/65448061-c9d96a00-ddec-11e9-9dc5-625c777caffd.png)

## Is this a regression?
That is, did this use to work the way you expected in the past?
yes / no

# Debug info
- Streamlit version: 0.45/0.46
- OS version: MacOs
- Browser version: Chrome

# Additional information
when I hit shift-cmd-r it goes away
https://streamlit.slack.com/archives/CNE9UNQDP/p1569258102000600



Discussion:
I think the a workaround we can do right now pre-launch would be to catch that ChunkLoadError Exception and display a prettier error.

Like saying, please press `shift-cmd-r` to reload or something like that
We could even link them to [this page](https://en.wikipedia.org/wiki/Wikipedia:Bypass_your_cache).

Resolving patch:
diff --git a/e2e/scripts/reuse_label.py b/e2e/scripts/reuse_label.py
--- a/e2e/scripts/reuse_label.py
+++ b/e2e/scripts/reuse_label.py
@@ -15,6 +15,9 @@
 
 import streamlit as st
 
+if st.button('Rerun test'):
+    st.test_run_count = -1
+
 if hasattr(st, "test_run_count"):
     st.test_run_count += 1
 else:
@@ -26,3 +29,9 @@
     w1 = st.selectbox("label", ("m", "f"), 1)
 
 st.write("value 1:", w1)
+st.write("test_run_count:", st.test_run_count)
+st.write("""
+    If this is failing locally, it could be because you have a browser with
+    Streamlit open. Close it and the test should pass.
+""")
+# TODO: Use session-specific state for test_run_count, to fix the issue above.
diff --git a/e2e/scripts/st_in_cache_warning.py b/e2e/scripts/st_in_cache_warning.py
--- a/e2e/scripts/st_in_cache_warning.py
+++ b/e2e/scripts/st_in_cache_warning.py
@@ -34,3 +34,8 @@ def cached_widget(name):
 cached_write("I'm in a cached function!")
 cached_widget("Wadjet!")
 cached_write_nowarn("Me too!")
+
+st.write("""
+    If this is failing locally, it could be because you have a browser with
+    Streamlit open. Close it and the test should pass.
+""")
diff --git a/lib/streamlit/config.py b/lib/streamlit/config.py
--- a/lib/streamlit/config.py
+++ b/lib/streamlit/config.py
@@ -277,7 +277,7 @@ def _global_unit_test():
 
 _create_option(
     "global.minCachedMessageSize",
-    description="""Only cache ForwardMsgs that are greater than or equal to 
+    description="""Only cache ForwardMsgs that are greater than or equal to
         this minimum.""",
     visibility="hidden",
     default_val=10 * 1e3,
@@ -286,8 +286,8 @@ def _global_unit_test():
 
 _create_option(
     "global.maxCachedMessageAge",
-    description="""Expire cached ForwardMsgs whose age is greater than this 
-        value. A message's age is defined by how many times its script has 
+    description="""Expire cached ForwardMsgs whose age is greater than this
+        value. A message's age is defined by how many times its script has
         finished running since the message has been accessed.""",
     visibility="hidden",
     default_val=2,
@@ -442,7 +442,8 @@ def _gather_usage_stats():
 @_create_option("browser.serverPort")
 @util.memoize
 def _browser_server_port():
-    """Port that the browser should use to connect to the server.
+    """Port that the browser should use to connect to the server when in
+    liveSave mode.
 
     Default: whatever value is set in server.port.
     """


Test patch:
diff --git a/scripts/run_e2e_tests.sh b/scripts/run_e2e_tests.sh
--- a/scripts/run_e2e_tests.sh
+++ b/scripts/run_e2e_tests.sh
@@ -25,16 +25,23 @@ always_continue=false
 any_failed=false
 
 # Flag to record test results in the cypress dashboard
-record_results=
+# Set to "--record" to turn on.
+record_results_flag=
+
+# Flag to update snapshots.
+# Set to "--env updateSnapshots=true" to turn on.
+snapshots_flag=
 
 # Handle command line named arguments, passed as `-c .. -a true`
-while getopts ":c:a:r" opt; do
+while getopts ":c:a:r:u" opt; do
   case $opt in
     c) cwd="$OPTARG"
     ;;
     a) always_continue="$OPTARG"
     ;;
-    r) record_results="--record"
+    r) record_results_flag="--record"
+    ;;
+    u) snapshots_flag="--env updateSnapshots=true"
     ;;
     \?) echo "Invalid option -$OPTARG" >&2
     ;;
@@ -74,6 +81,8 @@ rm mochawesome.json || true
 # Test core streamlit elements
 for file in ../e2e/scripts/*.py
 do
+  snapshots_flag_for_this_run=$snapshots_flag
+
   # Infinite loop to support retries.
   while true
   do
@@ -86,7 +95,7 @@ do
     yarn \
       cy:run \
       --spec $specpath \
-      $record_results
+      $record_results_flag $snapshots_flag_for_this_run
 
     EXITCODE="$?"
 
@@ -95,11 +104,12 @@ do
 
     # If exit code is nonzero, prompt user to continue or continue without prompting
     if [ "$EXITCODE" -ne "0" ] && [ "$always_continue" = "false" ]; then
-      read -p "Retry, Skip, or Quit? " key
+      read -p "Retry, Update snapshots, Skip, or Quit? " key
       case $key in
         [Ss]* ) break ;;
         [Qq]* ) exit 1 ;;
         [Rr]* ) continue ;;
+        [Uu]* ) snapshots_flag_for_this_run="--env updateSnapshots=true"; continue ;;
         * ) continue ;;  # Retry if key not recognized.
       esac
     elif [ "$EXITCODE" -ne "0" ] && [ "$always_continue" = "true" ]; then