Skip to content

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

perf: don't render properties view until needed

thecodrrd293ed151796
diff --git a/apps/web/src/components/editor/index.js b/apps/web/src/components/editor/index.js
index 360a1e47b..4fc7851b3 100644
--- a/apps/web/src/components/editor/index.js
+++ b/apps/web/src/components/editor/index.js
@@ -34,7 +34,7 @@ function Editor({ noteId, nonce }) {
const newSession = useStore((store) => store.newSession);
const openSession = useStore((store) => store.openSession);
const toggleProperties = useStore((store) => store.toggleProperties);
- const updateWordCount = useStore((store) => store.updateWordCount);
+ const arePropertiesVisible = useStore((store) => store.arePropertiesVisible);
const init = useStore((store) => store.init);
const isFocusMode = useAppStore((store) => store.isFocusMode);
const isMobile = useMobile();
@@ -227,7 +227,7 @@ function Editor({ noteId, nonce }) {
)}
</AnimatedFlex>
</Flex>
- <Properties noteId={noteId} />
+ {arePropertiesVisible && <Properties noteId={noteId} />}
</Flex>
);
}
diff --git a/apps/web/src/components/properties/index.js b/apps/web/src/components/properties/index.js
index 1053e87e7..1790050fb 100644
--- a/apps/web/src/components/properties/index.js
+++ b/apps/web/src/components/properties/index.js
@@ -25,7 +25,6 @@ const tools = [
function Properties({ noteId }) {
const [attachmentsStatus, setAttachmentsStatus] = useState({});
- const arePropertiesVisible = useStore((store) => store.arePropertiesVisible);
const color = useStore((store) => store.session.color);
const notebooks = useStore((store) => store.session.notebooks);
const attachments = useStore((store) => store.session.attachments);
@@ -80,7 +79,7 @@ function Properties({ noteId }) {
<>
<AnimatedFlex
animate={{
- x: arePropertiesVisible ? 0 : 800,
+ x: 0,
}}
transition={{
duration: 0.3,
@@ -88,7 +87,7 @@ function Properties({ noteId }) {
bounceStiffness: 1,
ease: "easeOut",
}}
- initial={false}
+ initial={{ x: 800 }}
sx={{
display: "flex",
position: "absolute",