LifeAdventurer/patient-diet-recorder

Feat: Reverse the records in monitor/

Closed this issue · 1 comments

Unlike patient/, monitor/ has multiple data from different individuals

Problem facing:

<div v-for="(dailyRecord, index2) in patientRecords[patientAccount]">

If I use the same method adding a reversedRecord() function in the computed() {}, and passing the patientAccount through reversedRecord will get an error Maximum call stack size exceeded

It seems this cannot be done by calling a function in v-for.

https://devpress.csdn.net/vue/63172e3e237eb178e9dfba27.html

When v-for calls your method it doesn't wait for the Axios call to resolve and since there is no array immediately available for it to iterate on, it can't show anything

https://www.reddit.com/r/vuejs/comments/jkjizt/vue3_call_function_on_a_vfor_after_fetch_apihelp/

Do not call functions in your HTML. Create a computed property that returns the data already filtered/massaged as needed.