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:
Navigate to the settings page.
Click on the 'Remove me' button next to 'Unsubscribe from all notifications'.
Observe the network activity showing repeated DELETE requests, and the browser console showing the runtime error
Possible Issues:
The dependencies of the useEffect might include objects or states that change frequently, causing the effect to rerun.
State updates within the effect might be causing the effect itself to rerun.
Suggested Areas for Investigation:
Review the dependency array of useEffect to ensure it only includes necessary dependencies.
Check if there are any unnecessary re-renders or state updates that might be triggering the effect redundantly.
Consider implementing a comparison check before performing the DELETE operation to ensure it only happens when actually needed.
Issue Description:
The
deleteHelper
function within theuseEffect
inuserStore.ts
is causing repeated, unintended DELETE requests. This behavior results in performance degradation and potential stability issues. TheuseEffect
seems to be triggered repeatedly under certain conditions, which continuously calls thedeleteMethod
.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:Steps to Reproduce:
Possible Issues:
useEffect
might include objects or states that change frequently, causing the effect to rerun.Suggested Areas for Investigation:
useEffect
to ensure it only includes necessary dependencies.