Skip to content

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

fix: no refresh on changing opened note color (fixes streetwriters/notesnook#207)

thecodrrb18d6ab149b9
diff --git a/apps/web/src/components/list-item/index.js b/apps/web/src/components/list-item/index.js
index 0f6f076d5..5bb2a4419 100644
--- a/apps/web/src/components/list-item/index.js
+++ b/apps/web/src/components/list-item/index.js
@@ -88,7 +88,7 @@ const ItemSelector = ({ isSelected, toggleSelection }) => {
function ListItem(props) {
const {
- colors: { text, background } = {
+ colors: { text, background, primary } = {
primary: "primary",
text: "text",
background: "background",
@@ -158,7 +158,9 @@ function ListItem(props) {
height: "inherit",
cursor: "pointer",
position: "relative",
- boxShadow: isFocused ? "5px 2px 0px -2px var(--primary) inset" : "none",
+ boxShadow: isFocused
+ ? `5px 2px 0px -2px var(--${primary}) inset`
+ : "none",
transition: "box-shadow 200ms ease-in",
":hover": {
backgroundColor: "hover",
@@ -168,7 +170,7 @@ function ListItem(props) {
},
":focus-visible": {
border: "1px solid",
- borderColor: "primary",
+ borderColor: primary,
},
overflow: "hidden",
maxWidth: "100%",
diff --git a/apps/web/src/stores/note-store.js b/apps/web/src/stores/note-store.js
index 79467ab81..25031d037 100644
--- a/apps/web/src/stores/note-store.js
+++ b/apps/web/src/stores/note-store.js
@@ -86,18 +86,16 @@ class NoteStore extends BaseStore {
if (!note.data.pinned && db.notes.pinned.length >= 3) {
throw new Error("You cannot pin more than 3 notes.");
}
- if (!this._syncEditor(note.id, "pinned", !note.data.pinned)) {
- await note.pin();
- this.refresh();
- }
+ await note.pin();
+ this._syncEditor(note.id, "pinned", !note.data.pinned);
+ this.refresh();
};
favorite = async (id) => {
const note = db.notes.note(id);
- if (!this._syncEditor(note.id, "favorite", !note.data.favorite)) {
- await note.favorite();
- this.refresh();
- }
+ await note.favorite();
+ this._syncEditor(note.id, "favorite", !note.data.favorite);
+ this.refresh();
};
unlock = async (id) => {
@@ -123,9 +121,8 @@ class NoteStore extends BaseStore {
if (note.data.color === color) await db.notes.note(id).uncolor();
else await db.notes.note(id).color(color);
appStore.refreshColors();
- if (!this._syncEditor(note.id, "color", db.notes.note(id).data.color)) {
- this.refresh();
- }
+ this._syncEditor(note.id, "color", db.notes.note(id).data.color);
+ this.refresh();
} catch (e) {
console.error(e);
}