PromucFlow_constructor/app/client/src/selectors/globalSearchSelectors.tsx
Satish Gandham 88c92fd2f5
Fix unnecessary renders of ActionCreator, EntityName, CodeEditor and ActionEntityContextMenu (#6242)
* Fix action creator unnecessary render issue
- Optimize the selectors and hooks to return new values only when something has changed.

* Fix ActionEntityContextMenu re-renders issue

* Prevent rerenders of EntityName component

* Fix CodeEditor re-renders

* Use createSelector instead of memoization.

* Cleanup

* - Remove whyDidYouRender

Co-authored-by: Satish Gandham <satish@appsmith.com>
2021-08-02 21:36:33 +05:30

15 lines
407 B
TypeScript

import { createSelector } from "reselect";
import { AppState } from "reducers";
import { RecentEntity } from "components/editorComponents/GlobalSearch/utils";
export const getRecentEntities = (state: AppState) =>
state.ui.globalSearch.recentEntities;
export const getRecentEntityIds = createSelector(
getRecentEntities,
(entities: RecentEntity[]) => {
return entities.map((r) => r.id);
},
);