1111< body >
1212 < div class ="demo__source-bar " id ="source-bar ">
1313 < div class ="container ">
14+ Loading source info...
1415 </ div >
1516 </ div >
16- < div class ="container ">
17- < h1 > Python Friendly Error Messages - Demo</ h1 >
18- </ div >
1917
20- < div id ="demo-container " class ="demo__table-page ">
18+ < h1 > Python Friendly Error Messages - Demo</ h1 >
19+
20+ < div class ="demo__table-page " id ="demo-container ">
2121 Loading demo...
2222 </ div >
2323
@@ -26,7 +26,16 @@ <h1>Python Friendly Error Messages - Demo</h1>
2626
2727 const pageParams = new URLSearchParams ( window . location . search ) ;
2828 const useLocal = pageParams . has ( 'local' ) ;
29- const cacheBust = pageParams . get ( 'cb' ) ;
29+ const navigationEntry = performance . getEntriesByType ( 'navigation' ) [ 0 ] ;
30+ const isReload = navigationEntry && navigationEntry . type === 'reload' ;
31+ let cacheBust = pageParams . get ( 'cb' ) ;
32+
33+ if ( isReload ) {
34+ cacheBust = String ( Date . now ( ) ) ;
35+ pageParams . set ( 'cb' , cacheBust ) ;
36+ const nextUrl = `${ window . location . pathname } ?${ pageParams . toString ( ) } ${ window . location . hash } ` ;
37+ window . history . replaceState ( null , '' , nextUrl ) ;
38+ }
3039
3140 const libPathBase = useLocal
3241 ? '../dist/index.browser.js'
@@ -38,7 +47,7 @@ <h1>Python Friendly Error Messages - Demo</h1>
3847 async function initDemo ( ) {
3948 const container = document . getElementById ( 'demo-container' ) ;
4049
41- const switchUrl = useLocal ? 'index.html' : 'index.html?local' ;
50+ const switchUrl = useLocal ? 'index.html' : 'index.html?local=true ' ;
4251 const bar = document . querySelector ( '#source-bar .container' ) ;
4352 if ( useLocal ) {
4453 bar . innerHTML = `
0 commit comments