Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

web: fix unnecessary rerenders of the tab strip

Abdullah Attae5cf90278055
diff --git a/apps/web/src/components/editor/action-bar.tsx b/apps/web/src/components/editor/action-bar.tsx
index 19411c74d..274343294 100644
--- a/apps/web/src/components/editor/action-bar.tsx
+++ b/apps/web/src/components/editor/action-bar.tsx
@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import { Button, Flex, Text } from "@theme-ui/components";
-import { useEffect, useRef, useState } from "react";
+import React, { useEffect, useRef, useState } from "react";
import {
ArrowLeft,
ArrowRight,
@@ -250,7 +250,7 @@ export function EditorActionBar() {
);
}
-function TabStrip() {
+const TabStrip = React.memo(function TabStrip() {
const tabs = useEditorStore((store) => store.tabs);
const currentTab = useEditorStore((store) => store.activeTabId);
const canGoBack = useEditorStore((store) => store.canGoBack);
@@ -424,7 +424,7 @@ function TabStrip() {
</ScrollContainer>
</Flex>
);
-}
+});
type TabProps = {
id: string;