Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when switching notes #5267

Closed
msbentley opened this issue Aug 5, 2021 · 3 comments
Closed

Error when switching notes #5267

msbentley opened this issue Aug 5, 2021 · 3 comments
Labels
bug It's a bug desktop All desktop platforms high High priority issues upstream There's a problem with upstream code.

Comments

@msbentley
Copy link

After running a search I rapidly switched notes from the top two in the search (back and forth) and was met with the error below:

Error
Joplin encountered a fatal error and could not continue. To report the error, please copy the *entire content* of this page and post it on Joplin forum or GitHub.

To continue you may close the app. Alternatively, if the error persists you may try to restart in safe mode, which will temporarily disable all plugins.

Message
Cannot read property 'code' of undefined

Version info
Joplin for Desktop

Copyright © 2016-2021 Laurent Cozic
Joplin 2.2.2 (prod, linux)

Client ID: 299bc04f2e774bd1ac20680972be9a47
Sync Version: 2
Profile Version: 39
Keychain Supported: No

Revision: 37ad613
Plugins
[
    {
        "id": "com.whatever.quick-links",
        "name": "Quick Links",
        "enabled": true,
        "version": "1.2.1"
    },
    {
        "id": "joplin.plugin.benji.persistentLayout",
        "name": "Persistent Editor Layout",
        "enabled": true,
        "version": "2.0.0"
    },
    {
        "id": "joplin.plugin.ambrt.copyNoteLink",
        "name": "Copy link to active note",
        "enabled": true,
        "version": "1.0.1"
    },
    {
        "id": "plugin.calebjohn.rich-markdown",
        "name": "Rich Markdown",
        "enabled": true,
        "version": "0.6.1"
    },
    {
        "id": "joplin.plugin.note.tabs",
        "name": "Note Tabs",
        "enabled": true,
        "version": "1.3.0"
    },
    {
        "id": "net.rmusin.joplin-table-formatter",
        "name": "Table Formatter Plugin",
        "enabled": true,
        "version": "1.1.2"
    },
    {
        "id": "io.treymo.LinkGraph",
        "name": "Link Graph UI",
        "enabled": true,
        "version": "0.9.9"
    },
    {
        "id": "joplin.plugin.ambrt.backlinksToNote",
        "name": "Automatic Backlinks to note",
        "enabled": false,
        "version": "2.0.10"
    }
]
Stack trace
TypeError: Cannot read property 'code' of undefined
    at o (/home/mbentley/.config/joplin-desktop/cache/plugin.calebjohn.rich-markdown/richMarkdown.js:1:4383)
    at Object.e.onSourceChanged (/home/mbentley/.config/joplin-desktop/cache/plugin.calebjohn.rich-markdown/richMarkdown.js:1:4869)
    at l (/home/mbentley/.config/joplin-desktop/cache/plugin.calebjohn.rich-markdown/richMarkdown.js:1:7204)
    at /tmp/.mount_Joplin5h4m1e/resources/app.asar/node_modules/codemirror/lib/codemirror.js:2076:45
    at fireCallbacksForOps (/tmp/.mount_Joplin5h4m1e/resources/app.asar/node_modules/codemirror/lib/codemirror.js:2033:24)
    at finishOperation (/tmp/.mount_Joplin5h4m1e/resources/app.asar/node_modules/codemirror/lib/codemirror.js:2047:11)
    at endOperation (/tmp/.mount_Joplin5h4m1e/resources/app.asar/node_modules/codemirror/lib/codemirror.js:3787:15)
    at Doc.setValue (/tmp/.mount_Joplin5h4m1e/resources/app.asar/node_modules/codemirror/lib/codemirror.js:3943:17)
    at CodeMirror.setValue (/tmp/.mount_Joplin5h4m1e/resources/app.asar/node_modules/codemirror/lib/codemirror.js:9741:40)
    at /tmp/.mount_Joplin5h4m1e/resources/app.asar/gui/NoteEditor/NoteBody/CodeMirror/Editor.js:165:24
Component stack

    in ForwardRef(Editor) (created by ForwardRef(CodeMirror))
    in div (created by ForwardRef(CodeMirror))
    in div (created by ForwardRef(CodeMirror))
    in div (created by ForwardRef(CodeMirror))
    in ForwardRef(CodeMirror) (created by NoteEditor)
    in div (created by NoteEditor)
    in div (created by NoteEditor)
    in div (created by NoteEditor)
    in NoteEditor (created by Connect(NoteEditor))
    in Connect(NoteEditor) (created by ResizableLayout)
    in div (created by styled.div)
    in styled.div (created by ResizableLayout)
    in div (created by ResizableLayout)
    in div (created by ResizableLayout)
    in div (created by ResizableLayout)
    in ResizableLayout (created by MainScreenComponent)
    in div (created by MainScreenComponent)
    in MainScreenComponent (created by Connect(MainScreenComponent))
    in Connect(MainScreenComponent) (created by NavigatorComponent)
    in div (created by NavigatorComponent)
    in NavigatorComponent (created by Connect(NavigatorComponent))
    in Connect(NavigatorComponent) (created by RootComponent)
    in ThemeProvider (created by RootComponent)
    in StyleSheetManager (created by RootComponent)
    in RootComponent (created by Connect(RootComponent))
    in Connect(RootComponent)
    in ErrorBoundary
    in Provider

Environment

Joplin version: 2.2.2
Platform: linux
OS specifics: ubuntu 20.04

Steps to reproduce

Unable to reproduce yet, but I'll post back if I trigger it again

@msbentley msbentley added the bug It's a bug label Aug 5, 2021
@laurent22
Copy link
Owner

Looks like a bug in the Rich Markdown plugin content script. @CalebJohn, I think it might be that line: https://github.com/CalebJohn/joplin-rich-markdown/blob/87cfd7821b5b0e015f4c274bfed86cecc3b9a834/src/overlay.ts#L37 Perhaps "outer" is not always defined when the note has just loaded.

@laurent22 laurent22 added desktop All desktop platforms high High priority issues upstream There's a problem with upstream code. labels Aug 5, 2021
CalebJohn added a commit to CalebJohn/joplin-rich-markdown that referenced this issue Aug 5, 2021
laurent22/joplin#5267
Becuase the highlighting code runs after a change, it's
not guarenteed that the state variable will be completely
initialized for all lines.
This change adds a simple check for this. In testing this
didn't seem to affect the behaviour negatively.
@CalebJohn
Copy link
Collaborator

Thanks for identifying this @laurent22. Fortunately, I was able to reproduce this repeatedly and confirm the issue.

@msbentley I've created v0.6.2 that includes a fix for this issue. It should become available within an hour. Thanks for the report!

@msbentley
Copy link
Author

Fantastic, thanks @CalebJohn @laurent22 for the speedy bug tracking/fixing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug It's a bug desktop All desktop platforms high High priority issues upstream There's a problem with upstream code.
Projects
None yet
Development

No branches or pull requests

3 participants