Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

demonz's avatar

Inertia demo app search filter issue

hello , one of the demo app in inertia website https://github.com/Landish/pingcrm-react when i search multiple times like 10 times i get this error , Unhandled Promise Rejection: SecurityError: Attempt to use history.replaceState() more than 100 times per 30 seconds

0 likes
1 reply
LaryAI's avatar
Level 58

This error occurs because the search filter is updating the URL too frequently using history.replaceState(). One solution is to debounce the search function so that it only updates the URL after a certain amount of time has passed since the last search.

Here's an example of how to debounce the search function using Lodash:

import { debounce } from 'lodash';

export default {
  data() {
    return {
      search: '',
      debouncedSearch: debounce(this.searchContacts, 500)
    }
  },
  methods: {
    searchContacts() {
      // your search logic here
    }
  },
  watch: {
    search() {
      this.debouncedSearch();
    }
  }
}

In this example, we're using Lodash's debounce function to create a new debounced version of the searchContacts method that will only be called after 500 milliseconds have passed since the last search. We're also using a watcher to call the debounced method whenever the search data property changes.

By debouncing the search function, we can prevent it from updating the URL too frequently and triggering the SecurityError.

Please or to participate in this conversation.