Dispatching Vuex getter via setInterval
Responding to your question


  Is there a best practices way to [dispatch the getter via an interval]?


You could consider using requestAnimationFrame() (read more about using that with setInterval() in articles like this one) but that might be overkill since you are just updating a list.

Another option to consider is using websockets (presuming your server-side would support it). That way the client-side could be notified of updates to the list instead of having to request them periodically.

Bug in the sample code

The sample code shows these methods:


    created() {
        this.fetchFriendList()
        setInterval(this.fetchFriendList, 3000)
    },
    destroy() {
        clearInterval(this.fetchFriendList)
    },



However, clearInterval() takes an intervalID as a parameter, not a function reference.


  Parameters
  
  intervalID
  The identifier of the repeated action you want to cancel. This ID was returned by the corresponding call to setInterval().1


So instead of passing the method reference this.fetchFriendList, pass an identifier returned from the call to setInterval() in the created method.

1https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/clearInterval#Parameters