[lib] Avoid creating new array on every invocation of useThreadHasPermission
Summary:
The web app has been really slow to update whenever the ThreadStore changes, so I decided to do some quick profiling on prod using the Chrome Dev Tools.
I noticed that the browser was spending a lot of time on useThreadsWithPermission, so I investigated its callers. That led me to identity this perf issue where we are forcing useThreadsWithPermission to be recalculated on every call to useThreadHasPermission.
Test Plan: Flow
Reviewers: angelika, tomek
Reviewed By: angelika, tomek
Differential Revision: https://phab.comm.dev/D13874