oriolmirosa / open-files

Atom package to show the open files in the tree-view panel, mirroring the functionality in Sublime Text
https://atom.io/packages/open-files
MIT License
15 stars 10 forks source link

Uncaught TypeError: Cannot read property 'classList' of null #19

Open LuisFRosas opened 7 years ago

LuisFRosas commented 7 years ago

[Enter steps to reproduce:]

  1. ...
  2. ...

Atom: 1.18.0 x64 Electron: 1.3.15 OS: Unknown Windows version Thrown From: open-files package 0.8.2

Stack Trace

Uncaught TypeError: Cannot read property 'classList' of null

At C:\Users\Luis\.atom\packages\open-files\lib\open-files-pane-view.js:454

TypeError: Cannot read property 'classList' of null
    at OpenFilesPaneView.updateModifiedState (/packages/open-files/lib/open-files-pane-view.js:454:20)
    at /packages/open-files/lib/open-files-pane-view.js:405:22
    at Function.module.exports.Emitter.simpleDispatch (~/AppData/Local/atom/app-1.18.0/resources/app/node_modules/event-kit/lib/emitter.js:25:20)
    at Emitter.module.exports.Emitter.emit (~/AppData/Local/atom/app-1.18.0/resources/app/node_modules/event-kit/lib/emitter.js:141:34)
    at TextBuffer.module.exports.TextBuffer.emitModifiedStatusChanged (~/AppData/Local/atom/app-1.18.0/resources/app/node_modules/text-buffer/lib/text-buffer.js:1457:33)
    at ~/AppData/Local/atom/app-1.18.0/resources/app/node_modules/text-buffer/lib/text-buffer.js:1446:30

Commands

  3x -2:41.3.0 core:save (input.hidden-input)
  2x -0:48.4.0 editor:newline (input.hidden-input)
  2x -0:46 core:backspace (input.hidden-input)
     -0:43.6.0 editor:newline (input.hidden-input)
     -0:41.8.0 autocomplete-plus:confirm (input.hidden-input)
     -0:41.7.0 autocomplete-plus:activate (atom-text-editor.editor.is-focused)
  3x -0:39.5.0 core:backspace (input.hidden-input)
     -0:37.9.0 autocomplete-plus:confirm (input.hidden-input)
     -0:27.6.0 editor:newline (input.hidden-input)
  2x -0:25.8.0 core:backspace (input.hidden-input)
     -0:24.5.0 autocomplete-plus:confirm (input.hidden-input)
     -0:24.5.0 autocomplete-plus:activate (atom-text-editor.editor.is-focused)
     -0:22.3.0 autocomplete-plus:confirm (input.hidden-input)
     -0:05.9.0 core:move-right (input.hidden-input)
     -0:04.9.0 autocomplete-plus:confirm (input.hidden-input)
     -0:04.9.0 autocomplete-plus:activate (atom-text-editor.editor.is-focused)

Non-Core Packages

browser-refresh-on-save 0.0.6 
emmet 2.4.3 
file-icons 2.1.7 
monokai-seti 0.9.0 
open-files 0.8.2 
opened-files 0.3.6 
Remote-FTP 0.10.7 
seti-syntax 1.1.3 
seti-ui 1.8.0 
wordpress-autocomplete 1.1.4 
oriolmirosa commented 7 years ago

Thanks for reporting this, @LuisFRosas. I will need some more info in order to debug this:

  1. Can you tell me what files and panels you had open when this happened?
  2. What file were you modifying?
  3. Can you reproduce the bug?
  4. I see that you had the opened-files package installed as well. It is possible that that's where the problem comes from. Have you tried to run only the open-files package and disable opened-files? If so, does the problem persist?

Thanks!

skjnldsv commented 7 years ago

I have this issue as well :( It happens when I try to close the settings when it's opened on the first pane.

kazam

sygint commented 6 years ago

I get this all the time just switching tabs

joedf commented 6 years ago

For me, it seems it is more particular switching to package changelog tabs

asdf23 commented 6 years ago

What was the tool to create the gif?

I seem to trigger this bug when I switch to a tab that does not have selected text. (Not sure this is related, but also both tabs are unsaved files).

This fails everytime ---> So workflow would be open atom, Ctrl + N, Ctrl + N, Ctrl + PageUp

greedylan commented 6 years ago

Do we have any update on this issue?

asdf23 commented 6 years ago

I try/caught this on my box and it's no longer crashing

skjnldsv commented 6 years ago

What was the tool to create the gif?

kazam + gifify

oriolmirosa commented 6 years ago

Sorry all for the radio silence. I have a new full-time job with a startup and I'm swamped, plus I'm a new dad, so things are crazy on my end. Moreover, I don't get the crash so it's hard to test and fix from here. I'll try to work on this during the weekend and will report back then. Sorry again.

misterbridge commented 6 years ago

Any news ?

asdf23 commented 5 years ago

open-files-pane-view.js

~line 454 Change

    if (entry) {
      entry.element.classList.toggle('modified', modified);
    }

to

    if (entry && entry.element) {
      entry.element.classList.toggle('modified', modified);
    }

and again ~ 470


                this.activeEntry = entry.element;
                entry.element.classList.add('selected');
            }```
Kanaduchi commented 4 years ago

@oriolmirosa Any updates on this issue? I get this error every day. It is very annoying

newlukai commented 4 years ago

I can reproduce this creating two files without saving them. Switching between both unnamed files raises this error.

pauljherring commented 4 years ago

Error:

Uncaught TypeError: Cannot read property 'classList' of null

/home/pherring/.atom/packages/open-files/lib/open-files-pane-view.js:472
Hide Stack Trace
TypeError: Cannot read property 'classList' of null
    at OpenFilesPaneView.setActiveEntry (/home/pherring/.atom/packages/open-files/lib/open-files-pane-view.js:472:19)
    at /home/pherring/.atom/packages/open-files/lib/open-files-pane-view.js:413:19
    at Function.simpleDispatch (/usr/share/atom/resources/app/static/<embedded>:11:1212922)
    at Emitter.emit (/usr/share/atom/resources/app/static/<embedded>:11:1214363)
    at Pane.setActiveItem (/usr/share/atom/resources/app/static/<embedded>:11:455685)
    at Pane.activateItem (/usr/share/atom/resources/app/static/<embedded>:11:457933)
    at TabBarView.onClick (/usr/share/atom/resources/app/static/<embedded>:11:1164009)
The error was thrown from the open-files package. This issue has already been reported.

What I did:

$ diff /home/pherring/.atom/packages/open-files/lib/open-files-pane-view.js{.old,} -u
--- /home/pherring/.atom/packages/open-files/lib/open-files-pane-view.js.old    2020-01-22 20:05:46.838623575 +0000
+++ /home/pherring/.atom/packages/open-files/lib/open-files-pane-view.js        2020-01-22 20:08:42.760613046 +0000
@@ -450,7 +450,7 @@

        updateModifiedState(item, modified) {
                let entry = this.entryForItem(item);
-    if (entry) {
+    if (entry && entry.element) {
       entry.element.classList.toggle('modified', modified);
     }
        }
@@ -467,7 +467,7 @@
                if (item) {
                        let entry = this.entryForItem(item);
                        this.activeEntry ? this.activeEntry.classList.remove('selected') : undefined;
-                       if (entry) {
+                       if (entry && entry.element) {
         this.activeEntry = entry.element;
                                entry.element.classList.add('selected');
                        }

While I can't confirm it's fixed the problem (it should) I've not had the error for a while...

Pysis868 commented 1 year ago

Made that PR.

Think this should work like the code posted here.

It happened to me I think when I split right to view the same file twice, maybe again and moved it back into the same left pane so I was viewing it 3 times in total.

I also saw some other fixes in the network/insights area for this project. I think it mentioned title code, and possibly more.

If this project is not being actively maintained, any recommendations for a fork?

pauljherring commented 1 year ago

If this project is not being actively maintained, any recommendations for a fork?

https://github.blog/2022-06-08-sunsetting-atom/

When we introduced Atom in 2011, we set out to give developers a text editor that was deeply customizable but also easy to use—one that made it possible for more people to build software. While that goal of growing the software creator community remains, we’ve decided to retire Atom in order to further our commitment to bringing fast and reliable software development to the cloud via Microsoft Visual Studio Code and GitHub Codespaces.

Pysis868 commented 1 year ago

This package is still relevant with the new project and forked text editor/IDE Pulsar here: https://pulsar-edit.dev/about.html

It is even how I am using the package now.