In the Home
view, there are two components: Filter
and Results
. The Results
component relies heavily on data from the vuex store, which is influenced by the Filter
component. Once the filters are applied and the user interacts with Filter
, the necessary data for Results
is generated in the store and this component should be displayed below Filter
.
The issue arises when I open the Home
view - the Results
component throws errors in the console such as
"TypeError: Cannot read property '0' of undefined"
. This is expected since the data is not yet available. I attempted to conditionally render Results
using <Results v-if="$store.state.data != {}" />
. While this prevents rendering when the page is initially loaded and waits for the data to be loaded after the user interaction, Results
still throws errors when the page is first opened.
One potential solution I considered is to populate the store with dummy data to avoid errors (and then render with an alternate condition). However, I believe there must be a solution that does not require the use of dummy data.