Tobias Brugger commited on
Commit
5699931
·
1 Parent(s): e7ae4c5

auto-reload

Browse files
Files changed (1) hide show
  1. src/lib/DatasetViewer.svelte +12 -7
src/lib/DatasetViewer.svelte CHANGED
@@ -33,11 +33,14 @@
33
  let prevJurisdiction1 = $state('en-us');
34
  let prevJurisdiction2 = $state('sv-se');
35
 
36
- // Reload when jurisdictions change
37
  $effect(() => {
38
- if (hasLoaded && (jurisdiction1 !== prevJurisdiction1 || jurisdiction2 !== prevJurisdiction2)) {
39
- prevJurisdiction1 = jurisdiction1;
40
- prevJurisdiction2 = jurisdiction2;
 
 
 
41
  loadComparison();
42
  }
43
  });
@@ -156,9 +159,11 @@
156
  </div>
157
  </div>
158
 
159
- <button onclick={loadComparison} disabled={loading}>
160
- {loading ? 'Loading...' : 'Load Comparison'}
161
- </button>
 
 
162
  </div>
163
 
164
  {#if error}
 
33
  let prevJurisdiction1 = $state('en-us');
34
  let prevJurisdiction2 = $state('sv-se');
35
 
36
+ // Reload when jurisdictions change (but not on initial mount)
37
  $effect(() => {
38
+ const j1 = jurisdiction1;
39
+ const j2 = jurisdiction2;
40
+
41
+ if (hasLoaded && (j1 !== prevJurisdiction1 || j2 !== prevJurisdiction2)) {
42
+ prevJurisdiction1 = j1;
43
+ prevJurisdiction2 = j2;
44
  loadComparison();
45
  }
46
  });
 
159
  </div>
160
  </div>
161
 
162
+ {#if !hasLoaded}
163
+ <button onclick={loadComparison} disabled={loading}>
164
+ {loading ? 'Loading...' : 'Load Comparison'}
165
+ </button>
166
+ {/if}
167
  </div>
168
 
169
  {#if error}