scottyzen / woonuxt

Static e-commerce powered by WooCommerce & Nuxt
https://woonuxt.com
GNU General Public License v3.0
639 stars 176 forks source link

:8080/my-account is only loading loop #172

Open Jackiiiii opened 3 months ago

Jackiiiii commented 3 months ago

Hello, i wanted to ask if u maybe know why my account page has an loading loop. i have install 3 wordpress, reinstall it on 2 server and still the same everything else works.

kind regards Jack

Jackiiiii commented 3 months ago

https://github.com/scottyzen/woonuxt/assets/33198895/8bc0808c-6964-40e4-8e1f-6220066c47c0

scottyzen commented 3 months ago

Hi @Jackiiiii,

Are there any errors in the console?

Jackiiiii commented 3 months ago

If i start the server, in the console i see no error, or do you mean somewhere else?

scottyzen commented 3 months ago

Right-click on the page and select inspect and then go to the console tab. If you want to GraphQL endpoint I'll take a look.

alexookah commented 2 months ago

@scottyzen I managed to reproduce the problem! My account waits forever the cart to load

defineNuxtPlugin in plugin.init.ts has this code:

    // Wait for the user to interact with the page before refreshing the cart, this is helpful to prevent excessive requests to the server
    let initialised = false;
    const eventsToFireOn = ['mousedown', 'keydown', 'touchstart', 'scroll', 'wheel', 'click', 'resize', 'mousemove', 'mouseover'];

Video:

https://github.com/user-attachments/assets/3cfd9e55-755c-43cb-a4fc-141f98ac4a1d

Unless there is some user interaction the cart wont try to load. The same problem occurs also in checkout page. If you try to refresh without any event triggering

I dont think it makes much sense with this events toFireOn. Maybe it should be configurable. But I would not enable this in my personal project. I think this code should be removed. Because in mobile if someone tries to open a page they might be waiting forever until they try to scroll up and down for the request to trigger.

WDYT? Should I make a PR removing this?

alexookah commented 1 month ago

@scottyzen @Jackiiiii this issue should be resolved now.