memos icon indicating copy to clipboard operation
memos copied to clipboard

Cached memo text when editing in different browsers

Open spaghetti-coder opened this issue 2 weeks ago • 1 comments

Pre-submission Checklist

  • [x] I have searched the existing issues and this bug has not been reported yet
  • [x] I have tested this issue on the demo site or the latest version

Where did you encounter this bug?

Latest stable version (self-hosted)

Memos Version

v0.25.3

Bug Description

Newly added text in one session is gone from the editor in another session

Steps to reproduce

  1. Create a note
    123
    
  2. Open memos in another browser / on another device / in incognito of the same browser
  3. Login with account used in step 1
  4. Click edit on the note from step 1 and press "Cancel" without editing. Don't close the login session
  5. In the browser from step 1 edit the note to
    123
    456
    
    and save it
  6. In the browser from step 3 refresh the page with the note. Note, the note is updated fine in view mode
  7. Open the note in edit mode

Expected

In edit mode I see:

123
456

Actial

In edit mode I see:

123

Impact

Working with a long text it's really easy to loose a big part of work after editing on another device

Screenshots & Additional Context

Client env:

  • Linux Mint 22.2, Chrome 142.0.7444.175 / Brave
  • Android 15, Chrome 142.0.7444.171

Deployment:

  • Container from official docker image
  • Official demo site

 

  Thanks for the great app. Really well designed and simple to use

spaghetti-coder avatar Dec 06 '25 00:12 spaghetti-coder

The issue comes from this combo https://github.com/usememos/memos/blob/48ce4ccc26642f9e19d6cb981d9dc6601d7c1ed2/web/src/components/MemoEditor/hooks/useMemoEditorInit.ts#L89 https://github.com/usememos/memos/blob/48ce4ccc26642f9e19d6cb981d9dc6601d7c1ed2/web/src/components/MemoEditor/index.tsx#L88

Was originally brought by https://github.com/usememos/memos/commit/36209eaef1c1d77a4eab0343c4ce4df3b4c59415

Can't really get what this caching is for. Yeah, can be handy in case of power loss or accident page refresh, but... Just for such corner cases it brings to situation when it's impossible to edit in multiple browsers.

Will create a discussion.

Quick workaround for now for those who doesn't need notes caching.

Admin account -> Settings -> System -> Additional script, paste:

setInterval(() => {
  Object.keys(localStorage).forEach((k) => {
    if (k.startsWith('users/')) localStorage.removeItem(k);
  });
}, 1000);

spaghetti-coder avatar Dec 10 '25 21:12 spaghetti-coder