Home / GitHub Page

Problem running compiled AppImage


#1

Hi,
trying to set up new development environment here on Linux (Kubuntu 18.04).
after couple of setbacks, I managed to get it compiling without errors.

but, when running the AppImage, everything else so far seem to work, except if I click on checkbox.
then I get a crash, and on the devtool console I have this:

devtool error messages (click to open, it's looong)
Uncaught TypeError: Cannot read property 'getSelection' of null
    at updateSelectionRange (/home/basse/src/joplin/ElectronClient/app/gui/NoteText.min.js:180)
    at Object.NoteTextComponent.aceEditor_selectionChange.selection [as onSelectionChange] (/home/basse/src/joplin/ElectronClient/app/gui/NoteText.min.js:189)
    at ReactAce.onSelectionChange (/home/basse/src/joplin/ElectronClient/app/node_modules/react-ace/lib/ace.js:272)
    at Selection.EventEmitter._emit.EventEmitter._dispatchEvent (/home/basse/src/joplin/ElectronClient/app/node_modules/brace/index.js:3849)
    at Selection.setSelectionAnchor (/home/basse/src/joplin/ElectronClient/app/node_modules/brace/index.js:5458)
    at Selection.setRange.setSelectionRange (/home/basse/src/joplin/ElectronClient/app/node_modules/brace/index.js:5526)
    at Selection.fromOrientedRange (/home/basse/src/joplin/ElectronClient/app/node_modules/brace/index.js:5961)
    at Selection.toSingleRange (/home/basse/src/joplin/ElectronClient/app/node_modules/brace/index.js:18688)
    at Selection.fromJSON (/home/basse/src/joplin/ElectronClient/app/node_modules/brace/index.js:6022)
    at ReactAce.componentDidUpdate (/home/basse/src/joplin/ElectronClient/app/node_modules/react-ace/lib/ace.js:195)
updateSelectionRange @ /home/basse/src/joplin/ElectronClient/app/gui/NoteText.min.js:180
NoteTextComponent.aceEditor_selectionChange.selection @ /home/basse/src/joplin/ElectronClient/app/gui/NoteText.min.js:189
onSelectionChange @ /home/basse/src/joplin/ElectronClient/app/node_modules/react-ace/lib/ace.js:272
EventEmitter._emit.EventEmitter._dispatchEvent @ /home/basse/src/joplin/ElectronClient/app/node_modules/brace/index.js:3849
setSelectionAnchor @ /home/basse/src/joplin/ElectronClient/app/node_modules/brace/index.js:5458
setRange.setSelectionRange @ /home/basse/src/joplin/ElectronClient/app/node_modules/brace/index.js:5526
fromOrientedRange @ /home/basse/src/joplin/ElectronClient/app/node_modules/brace/index.js:5961
toSingleRange @ /home/basse/src/joplin/ElectronClient/app/node_modules/brace/index.js:18688
fromJSON @ /home/basse/src/joplin/ElectronClient/app/node_modules/brace/index.js:6022
componentDidUpdate @ /home/basse/src/joplin/ElectronClient/app/node_modules/react-ace/lib/ace.js:195
commitLifeCycles @ /home/basse/src/joplin/ElectronClient/app/node_modules/react-dom/cjs/react-dom.development.js:14693
commitAllLifeCycles @ /home/basse/src/joplin/ElectronClient/app/node_modules/react-dom/cjs/react-dom.development.js:15905
callCallback @ /home/basse/src/joplin/ElectronClient/app/node_modules/react-dom/cjs/react-dom.development.js:145
invokeGuardedCallbackDev @ /home/basse/src/joplin/ElectronClient/app/node_modules/react-dom/cjs/react-dom.development.js:195
invokeGuardedCallback @ /home/basse/src/joplin/ElectronClient/app/node_modules/react-dom/cjs/react-dom.development.js:248
commitRoot @ /home/basse/src/joplin/ElectronClient/app/node_modules/react-dom/cjs/react-dom.development.js:16075
completeRoot @ /home/basse/src/joplin/ElectronClient/app/node_modules/react-dom/cjs/react-dom.development.js:17463
performWorkOnRoot @ /home/basse/src/joplin/ElectronClient/app/node_modules/react-dom/cjs/react-dom.development.js:17391
performWork @ /home/basse/src/joplin/ElectronClient/app/node_modules/react-dom/cjs/react-dom.development.js:17295
performSyncWork @ /home/basse/src/joplin/ElectronClient/app/node_modules/react-dom/cjs/react-dom.development.js:17267
requestWork @ /home/basse/src/joplin/ElectronClient/app/node_modules/react-dom/cjs/react-dom.development.js:17155
scheduleWork @ /home/basse/src/joplin/ElectronClient/app/node_modules/react-dom/cjs/react-dom.development.js:16949
enqueueSetState @ /home/basse/src/joplin/ElectronClient/app/node_modules/react-dom/cjs/react-dom.development.js:11623
Component.setState @ /home/basse/src/joplin/ElectronClient/app/node_modules/react/cjs/react.development.js:413
shared.saveOneProperty @ /home/basse/src/joplin/ElectronClient/app/lib/components/shared/note-screen-shared.js:125
_tickCallback @ internal/process/next_tick.js:188
/home/basse/src/joplin/ElectronClient/app/node_modules/react-dom/cjs/react-dom.development.js:14550 The above error occurred in the <ReactAce> component:
    in ReactAce (created by NoteTextComponent)
    in div (created by NoteTextComponent)
    in NoteTextComponent (created by Connect(NoteTextComponent))
    in Connect(NoteTextComponent) (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 RootComponent (created by Connect(RootComponent))
    in Connect(RootComponent)
    in Provider

Consider adding an error boundary to your tree to customize error handling behavior.
Visit https://fb.me/react-error-boundaries to learn more about error boundaries.
logCapturedError @ /home/basse/src/joplin/ElectronClient/app/node_modules/react-dom/cjs/react-dom.development.js:14550
logError @ /home/basse/src/joplin/ElectronClient/app/node_modules/react-dom/cjs/react-dom.development.js:14586
update.callback @ /home/basse/src/joplin/ElectronClient/app/node_modules/react-dom/cjs/react-dom.development.js:15273
callCallback @ /home/basse/src/joplin/ElectronClient/app/node_modules/react-dom/cjs/react-dom.development.js:11133
commitUpdateEffects @ /home/basse/src/joplin/ElectronClient/app/node_modules/react-dom/cjs/react-dom.development.js:11172
commitUpdateQueue @ /home/basse/src/joplin/ElectronClient/app/node_modules/react-dom/cjs/react-dom.development.js:11160
commitLifeCycles @ /home/basse/src/joplin/ElectronClient/app/node_modules/react-dom/cjs/react-dom.development.js:14721
commitAllLifeCycles @ /home/basse/src/joplin/ElectronClient/app/node_modules/react-dom/cjs/react-dom.development.js:15905
callCallback @ /home/basse/src/joplin/ElectronClient/app/node_modules/react-dom/cjs/react-dom.development.js:145
invokeGuardedCallbackDev @ /home/basse/src/joplin/ElectronClient/app/node_modules/react-dom/cjs/react-dom.development.js:195
invokeGuardedCallback @ /home/basse/src/joplin/ElectronClient/app/node_modules/react-dom/cjs/react-dom.development.js:248
commitRoot @ /home/basse/src/joplin/ElectronClient/app/node_modules/react-dom/cjs/react-dom.development.js:16075
completeRoot @ /home/basse/src/joplin/ElectronClient/app/node_modules/react-dom/cjs/react-dom.development.js:17463
performWorkOnRoot @ /home/basse/src/joplin/ElectronClient/app/node_modules/react-dom/cjs/react-dom.development.js:17391
performWork @ /home/basse/src/joplin/ElectronClient/app/node_modules/react-dom/cjs/react-dom.development.js:17295
performSyncWork @ /home/basse/src/joplin/ElectronClient/app/node_modules/react-dom/cjs/react-dom.development.js:17267
requestWork @ /home/basse/src/joplin/ElectronClient/app/node_modules/react-dom/cjs/react-dom.development.js:17155
scheduleWork @ /home/basse/src/joplin/ElectronClient/app/node_modules/react-dom/cjs/react-dom.development.js:16949
enqueueSetState @ /home/basse/src/joplin/ElectronClient/app/node_modules/react-dom/cjs/react-dom.development.js:11623
Component.setState @ /home/basse/src/joplin/ElectronClient/app/node_modules/react/cjs/react.development.js:413
shared.saveOneProperty @ /home/basse/src/joplin/ElectronClient/app/lib/components/shared/note-screen-shared.js:125
_tickCallback @ internal/process/next_tick.js:188
/home/basse/src/joplin/ElectronClient/app/gui/NoteText.min.js:180 Uncaught (in promise) TypeError: Cannot read property 'getSelection' of null
    at updateSelectionRange (/home/basse/src/joplin/ElectronClient/app/gui/NoteText.min.js:180)
    at Object.NoteTextComponent.aceEditor_selectionChange.selection [as onSelectionChange] (/home/basse/src/joplin/ElectronClient/app/gui/NoteText.min.js:189)
    at ReactAce.onSelectionChange (/home/basse/src/joplin/ElectronClient/app/node_modules/react-ace/lib/ace.js:272)
    at Selection.EventEmitter._emit.EventEmitter._dispatchEvent (/home/basse/src/joplin/ElectronClient/app/node_modules/brace/index.js:3849)
    at Selection.setSelectionAnchor (/home/basse/src/joplin/ElectronClient/app/node_modules/brace/index.js:5458)
    at Selection.setRange.setSelectionRange (/home/basse/src/joplin/ElectronClient/app/node_modules/brace/index.js:5526)
    at Selection.fromOrientedRange (/home/basse/src/joplin/ElectronClient/app/node_modules/brace/index.js:5961)
    at Selection.toSingleRange (/home/basse/src/joplin/ElectronClient/app/node_modules/brace/index.js:18688)
    at Selection.fromJSON (/home/basse/src/joplin/ElectronClient/app/node_modules/brace/index.js:6022)
    at ReactAce.componentDidUpdate (/home/basse/src/joplin/ElectronClient/app/node_modules/react-ace/lib/ace.js:195)
updateSelectionRange @ /home/basse/src/joplin/ElectronClient/app/gui/NoteText.min.js:180
NoteTextComponent.aceEditor_selectionChange.selection @ /home/basse/src/joplin/ElectronClient/app/gui/NoteText.min.js:189
onSelectionChange @ /home/basse/src/joplin/ElectronClient/app/node_modules/react-ace/lib/ace.js:272
EventEmitter._emit.EventEmitter._dispatchEvent @ /home/basse/src/joplin/ElectronClient/app/node_modules/brace/index.js:3849
setSelectionAnchor @ /home/basse/src/joplin/ElectronClient/app/node_modules/brace/index.js:5458
setRange.setSelectionRange @ /home/basse/src/joplin/ElectronClient/app/node_modules/brace/index.js:5526
fromOrientedRange @ /home/basse/src/joplin/ElectronClient/app/node_modules/brace/index.js:5961
toSingleRange @ /home/basse/src/joplin/ElectronClient/app/node_modules/brace/index.js:18688
fromJSON @ /home/basse/src/joplin/ElectronClient/app/node_modules/brace/index.js:6022
componentDidUpdate @ /home/basse/src/joplin/ElectronClient/app/node_modules/react-ace/lib/ace.js:195
commitLifeCycles @ /home/basse/src/joplin/ElectronClient/app/node_modules/react-dom/cjs/react-dom.development.js:14693
commitAllLifeCycles @ /home/basse/src/joplin/ElectronClient/app/node_modules/react-dom/cjs/react-dom.development.js:15905
callCallback @ /home/basse/src/joplin/ElectronClient/app/node_modules/react-dom/cjs/react-dom.development.js:145
invokeGuardedCallbackDev @ /home/basse/src/joplin/ElectronClient/app/node_modules/react-dom/cjs/react-dom.development.js:195
invokeGuardedCallback @ /home/basse/src/joplin/ElectronClient/app/node_modules/react-dom/cjs/react-dom.development.js:248
commitRoot @ /home/basse/src/joplin/ElectronClient/app/node_modules/react-dom/cjs/react-dom.development.js:16075
completeRoot @ /home/basse/src/joplin/ElectronClient/app/node_modules/react-dom/cjs/react-dom.development.js:17463
performWorkOnRoot @ /home/basse/src/joplin/ElectronClient/app/node_modules/react-dom/cjs/react-dom.development.js:17391
performWork @ /home/basse/src/joplin/ElectronClient/app/node_modules/react-dom/cjs/react-dom.development.js:17295
performSyncWork @ /home/basse/src/joplin/ElectronClient/app/node_modules/react-dom/cjs/react-dom.development.js:17267
requestWork @ /home/basse/src/joplin/ElectronClient/app/node_modules/react-dom/cjs/react-dom.development.js:17155
scheduleWork @ /home/basse/src/joplin/ElectronClient/app/node_modules/react-dom/cjs/react-dom.development.js:16949
enqueueSetState @ /home/basse/src/joplin/ElectronClient/app/node_modules/react-dom/cjs/react-dom.development.js:11623
Component.setState @ /home/basse/src/joplin/ElectronClient/app/node_modules/react/cjs/react.development.js:413
shared.saveOneProperty @ /home/basse/src/joplin/ElectronClient/app/lib/components/shared/note-screen-shared.js:125
_tickCallback @ internal/process/next_tick.js:188

so it kind of looks like it doesn’t find the editor?

line 180: 	const ranges = this.rawEditor().getSelection().getAllRanges();

any ideas? this only happens on my own compiled app.
here’s a link to the one I have :
https://drive.google.com/open?id=1bA337djX37I3xlwFRwNJh5mJBKviG6a9

thanks,

.b


#2

I can’t replicate this - could you post the Markdown of the note you are testing with?


#3

Either way, it’s true that rawEditor() can sometimes return null if the editor is not fully initialised yet, so I’ll add a check at this point.


#4

well, it only seems to happen on my own compiled AppImage, or, with the unpacked version too…
so do you mean you tried my AppImage, and it worked on your machine?

but it’s just a simple thing, like this:
(and crashes if I tick any of them on or off…, weird)

header

header
======
- [ ] 1
- [X] 2
- [ ] 3
- [ ] &#160;

.

id: ff5d77ee77f347c4861efe9dae313ba7
parent_id: 1e482fcfda0d4d708e7c77da89c12dde
created_time: 2018-10-04T17:03:24.608Z
updated_time: 2018-10-04T17:05:50.671Z
is_conflict: 0
latitude: 60.25200000
longitude: 25.01710000
altitude: 0.0000
author: &#160;
source_url: &#160;
is_todo: 0
todo_due: 0
todo_completed: 0
source: joplin-desktop
source_application: net.cozic.joplin-desktop
application_data: &#160;
order: 0
user_created_time: 2018-10-04T17:03:24.608Z
user_updated_time: 2018-10-04T17:05:50.671Z
encryption_cipher_text: &#160;
encryption_applied: 0
type_: 1

#5

I can’t replicate it with this sample note either and I don’t have Linux to test the AppImage. Is there any chance you could change the source code and see if it fixes your problem?

In ElectronClient\app\gui\NoteText.jsx:

In NoteText.jsx, change the updateSelectionRange function to this:

	const updateSelectionRange = () => {
		if (!this.rawEditor()) {
			this.selectionRange_ = null;
			return;
		}

		const ranges = this.rawEditor().getSelection().getAllRanges();
		if (!ranges || !ranges.length || !this.state.note) {
			this.selectionRange_ = null;
		} else {
			this.selectionRange_ = ranges[0];
		}
	}

If you could try this and see if you can click the checkboxes without crashing that would be great.


#6

yes, I actually forked the repo, and did similar fix…

well mine was if else sentence, but basicly does the same thing.

anyways, that seemed to stop the crashing.

I’m not much of a Electron coder (but I’m trying to learn), so took me a bit of time to understand that it’s not the .min.js files that I had to modify, but .jsx… :slight_smile: why is that really? the files look identical, so why this generating thing?

but yes, thanks for the info. it’s working now. and, I managed to also activate themes for desktop application, and now making a dark theme to work…

.b


#7

This is mostly to convert the HTML code to JavaScript. If you look at what returns the render() function, it’s different in the .min.js file.

The dark theme looks great!