File tree Expand file tree Collapse file tree 1 file changed +5
-7
lines changed Expand file tree Collapse file tree 1 file changed +5
-7
lines changed Original file line number Diff line number Diff line change @@ -17,8 +17,9 @@ type DataRecord = {
17
17
18
18
const { width } = useElementSize (cardRef )
19
19
20
- // We use `useAsyncData` here to have same random data on the client and server
21
- const { data } = await useAsyncData <DataRecord []>(async () => {
20
+ const data = ref <DataRecord []>([])
21
+
22
+ watch ([() => props .period , () => props .range ], () => {
22
23
const dates = ({
23
24
daily: eachDayOfInterval ,
24
25
weekly: eachWeekOfInterval ,
@@ -28,11 +29,8 @@ const { data } = await useAsyncData<DataRecord[]>(async () => {
28
29
const min = 1000
29
30
const max = 10000
30
31
31
- return dates .map (date => ({ date , amount: Math .floor (Math .random () * (max - min + 1 )) + min }))
32
- }, {
33
- watch: [() => props .period , () => props .range ],
34
- default : () => []
35
- })
32
+ data .value = dates .map (date => ({ date , amount: Math .floor (Math .random () * (max - min + 1 )) + min }))
33
+ }, { immediate: true })
36
34
37
35
const x = (_ : DataRecord , i : number ) => i
38
36
const y = (d : DataRecord ) => d .amount
You can’t perform that action at this time.
0 commit comments