perf(ui): optimize all selectors 1

I learned that the inline selector syntax recreates the selector function on every render:

```ts
const val = useAppSelector((s) => s.slice.val)
```

Not good! Better is to create a selector outside the function and use it. Doing that for all selectors now, most of the way through now. Feels snappier.
This commit is contained in:
psychedelicious
2024-08-27 13:19:14 +10:00
parent 04f78a99ad
commit bac0ce1e69
92 changed files with 561 additions and 294 deletions

View File

@@ -1,3 +1,4 @@
import type { RootState } from 'app/store/store';
import { createSelector } from '@reduxjs/toolkit';
import { selectConfigSlice } from 'features/system/store/configSlice';
export const configSelector = (state: RootState) => state.config;
export const selectAllowPrivateBoards = createSelector(selectConfigSlice, (config) => config.allowPrivateBoards);