Skip to content

Commit

Permalink
perf(components): remove inefficient createSelector in Export
Browse files Browse the repository at this point in the history
```
The result function returned its own inputs without modification.
This could lead to inefficient memoization and unnecessary re-renders.
Ensure transformation logic is in the result function, and extraction logic is in the input selectors.
```

https://redux.js.org/usage/deriving-data-selectors#createselector-overview
  • Loading branch information
remarkablemark committed Dec 31, 2023
1 parent 9d650b7 commit 3583e1e
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions src/components/BoardControls/Export.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,14 @@ import { createSelector } from '@reduxjs/toolkit';

import { logEvent } from '../../firebase';
import { useSelector } from '../../hooks';
import type { RootState } from '../../types';
import { transformToMarkdown } from './utils';

const selectColumns = createSelector(
(state: RootState) => state.columns,
(columns) => columns,
);

interface Props {
sx?: SxProps;
}

export default function Export(props: Props) {
const columns = useSelector(selectColumns);
const columns = useSelector((state) => state.columns);
const items = useSelector((state) => state.items);

async function copyBoardMarkdownToClipboard() {
Expand Down

0 comments on commit 3583e1e

Please sign in to comment.