Frequent categories -json loading error

We have customized our Discourse theme and implemented JavaScript for UI behavior to show different text for buttons based on different navigation menu. However, we frequently encounter an error when switching between categories, especially if we click quickly while the page is still loading. We’ve tried increasing the rate limit, but it hasn’t resolved the issue. How can we minimize or prevent this kind of error?

There should be more information under yourinstance.tld/logs when this error happens in the UI. Can you find a matching log entry and share the backtrace?

(post deleted by author)