AthletiFi / athletifi-website

Official website for AthletiFi
https://www.athleti.fi
1 stars 5 forks source link

Repeated Unintended DELETE Requests #261

Closed qisforq closed 1 month ago

qisforq commented 1 month ago

Issue Description:

The deleteHelper function within the useEffect in userStore.ts is causing repeated, unintended DELETE requests. This behavior results in performance degradation and potential stability issues. The useEffect seems to be triggered repeatedly under certain conditions, which continuously calls the deleteMethod.

Expected Behavior:

The deleteHelper function should only be invoked under specific conditions without causing repetitive API calls, especially when the underlying conditions have not changed.

Current Behavior:

The deleteHelper function is triggered repeatedly, causing a large number of DELETE requests in a short period. This occurs despite the lack of change in the conditions that should trigger such requests. Here is an excerpt from the server logs showing the repeated DELETE calls:

Repeated DELETE requests to /api/user with various notification_types parameters, all returning HTTP 200.

Steps to Reproduce:

  1. Navigate to the settings page.
  2. Click on the 'Remove me' button next to 'Unsubscribe from all notifications'.
  3. Observe the network activity showing repeated DELETE requests, and the browser console showing the runtime error

Possible Issues:

Suggested Areas for Investigation: