N
Nuxt9mo ago
marvin

Cannot read properties of null (reading 'previousSibling')

Hi, has anyone ever encountered the problem shown in the attached screenshot? I cant find any solution. Thanks!
No description
4 Replies
Eric
Eric9mo ago
it's probably an error in the code. It's a common error. Do you know what part of the code produces this error ?
marvin
marvinOP9mo ago
Hey sorry for that late answer. I unfortunately don't. The problem occurs in a project that shows galleries uploaded by a photographer to the user. This specific error occurs when the photographer opens the gallery page (pages/galleries/[id].vue). But it doesn't occur always, just sometimes
Eric
Eric9mo ago
Do you use the previousSibling in your code? It looks like an error because the DOM tries to acces some data that doesn't exist (yet). often because the app tries to create html elements based on data that hasn't arrived back from a fetch request. Sorry I took so long. do you still have the problem ?
marvin
marvinOP9mo ago
Hey @Eric. No I don't use the previousSibling function. I guess it is generated by the gallery grid, which is a simple v-for="photo in photos" while const photos = ref<Photo>([]) and in combination with a loadMorePhotos(page?: number): undefined function, which gets triggered once the user scrolls down to continously load new pages of photos from the server. However there is an additional call of that function right at the bottom of the component, to load the first page of photos on initial page load.
often because the app tries to create html elements based on data that hasn't arrived back from a fetch request.
So this could be an async/await problem? I will have a deeper look into that
Want results from more Discord servers?
Add your server