Skip to content
This repository was archived by the owner on Jun 20, 2023. It is now read-only.

Uncaught TypeError: Cannot read property 'reduce' of undefined #219

Closed
vtambourine opened this issue Apr 20, 2018 · 8 comments
Closed

Uncaught TypeError: Cannot read property 'reduce' of undefined #219

vtambourine opened this issue Apr 20, 2018 · 8 comments

Comments

@vtambourine
Copy link

[Enter steps to reproduce:]

  1. Open any file in the project tree.
  2. Execute "EditorConfig: Show State" command from the command palette.

Expected: Editor config status shown.
Result: Error appeared.

Atom: 1.26.0 x64
Electron: 1.7.11
OS: Mac OS X 10.12.6
Thrown From: editorconfig package 2.2.2

Stack Trace

Uncaught TypeError: Cannot read property 'reduce' of undefined

At /Users/vtambourine/.atom/packages/editorconfig/commands/show.js:5

TypeError: Cannot read property 'reduce' of undefined
    at notificationTemplate (/packages/editorconfig/commands/show.js:5:17)
    at HTMLElement.init (/packages/editorconfig/commands/show.js:55:17)
    at CommandRegistry.handleCommandEvent (/Applications/Atom.app/Contents/Resources/app/src/command-registry.js:384:49)
    at Object.didConfirmSelection (/Applications/Atom.app/Contents/Resources/app/node_modules/command-palette/lib/command-palette-view.js:152:35)
    at SelectListView.confirmSelection (/Applications/Atom.app/Contents/Resources/app/node_modules/atom-select-list/src/select-list-view.js:401:26)
    at HTMLDivElement.core:confirm (/Applications/Atom.app/Contents/Resources/app/node_modules/atom-select-list/src/select-list-view.js:106:20)
    at CommandRegistry.handleCommandEvent (/Applications/Atom.app/Contents/Resources/app/src/command-registry.js:384:49)
    at KeymapManager.module.exports.KeymapManager.dispatchCommandEvent (/Applications/Atom.app/Contents/Resources/app/node_modules/atom-keymap/lib/keymap-manager.js:621:22)
    at KeymapManager.module.exports.KeymapManager.handleKeyboardEvent (/Applications/Atom.app/Contents/Resources/app/node_modules/atom-keymap/lib/keymap-manager.js:412:28)
    at WindowEventHandler.handleDocumentKeyEvent (/Applications/Atom.app/Contents/Resources/app/src/window-event-handler.js:110:40)

Commands

  3x -3:35.4.0 core:close (input.hidden-input)
     -1:11.6.0 nuclide-file-tree:reveal-active-file (input.hidden-input)
  2x -0:43.9.0 core:close (input.hidden-input)
     -0:16.4.0 command-palette:toggle (input.hidden-input)
  3x -0:12 core:move-down (input.hidden-input)
     -0:11.3.0 core:move-up (input.hidden-input)
     -0:11.1.0 core:confirm (input.hidden-input)
     -0:11.1.0 EditorConfig:show-state (input.hidden-input)

Non-Core Packages

aligner 1.2.4 
aligner-javascript 1.3.0 
aligner-ruby 1.6.1 
editor-stats 0.17.0 
editorconfig 2.2.2 
highlight-selected 0.13.1 
language-crystal-actual 0.37.2 
language-docker 1.1.8 
language-perl-html-template 2.1.0 
language-riot-tag 0.2.2 
minimap 4.29.8 
minimap-bookmarks 0.4.2 
minimap-highlight-selected 4.6.1 
nuclide 0.291.0 
proto-repl 1.4.22 
riot 0.4.1 
@dennisgaebel
Copy link

This still occurs with Atom 1.35.1 running on Mojave OS

@Alhadis
Copy link
Collaborator

Alhadis commented Apr 2, 2019

@dennisgaebel Are you using Nuclide as well?

@dennisgaebel
Copy link

@Alhadis Nope. What else can I provide to help remedy this bug?

@Alhadis
Copy link
Collaborator

Alhadis commented Apr 2, 2019

Stack traces, a list of non-core packages you have installed, and what packages you purposefully disabled (if any). Similar to what @vtambourine provided in the OP.

Nuclide uses a very different set of UI components for Atom's workspace, replacing elements such as the file-tree with a more sophisticated project-browser, as well as other non-trivial replacements. These are the sorts of things that would naturally cause compatibility issues with certain packages assuming the existence of a tree-view pane...

@dennisgaebel
Copy link

@Alhadis Here are those deets. There is no Core packages that have been disabled on my end.

Stack Trace

Uncaught TypeError: Cannot read property 'reduce' of undefined

/Users/grayghost/.atom/packages/editorconfig/commands/show.js:6

TypeError: Cannot read property 'reduce' of undefined
    at notificationTemplate (/Users/grayghost/.atom/packages/editorconfig/commands/show.js:6:17)
    at HTMLElement.init (/Users/grayghost/.atom/packages/editorconfig/commands/show.js:56:17)
    at CommandRegistry.handleCommandEvent (/Applications/Atom.app/Contents/Resources/app/static/<embedded>:11:350017)
    at Object.didConfirmSelection (/Applications/Atom.app/Contents/Resources/app/static/<embedded>:11:677438)
    at SelectListView.confirmSelection (/Applications/Atom.app/Contents/Resources/app/static/<embedded>:11:840539)
    at HTMLDivElement.core:confirm (/Applications/Atom.app/Contents/Resources/app/static/<embedded>:11:835418)
    at CommandRegistry.handleCommandEvent (/Applications/Atom.app/Contents/Resources/app/static/<embedded>:11:350017)
    at KeymapManager.t.exports.KeymapManager.dispatchCommandEvent (/Applications/Atom.app/Contents/Resources/app/static/<embedded>:11:1212981)
    at KeymapManager.t.exports.KeymapManager.handleKeyboardEvent (/Applications/Atom.app/Contents/Resources/app/static/<embedded>:11:1209115)
    at WindowEventHandler.handleDocumentKeyEvent (/Applications/Atom.app/Contents/Resources/app/static/<embedded>:11:285196)

Non-Core Community Packages

@Alhadis
Copy link
Collaborator

Alhadis commented Apr 2, 2019

Gonna give this a thorough test and clean up. The exact error which was reported in the OP has so far been unreproducible, but the immediate fix is self-explanatory (check if value is null-ish before attempting to access a property or method).

Already patched it locally, will push as soon as I've finished trying to recreate the error...

@Alhadis Alhadis closed this as completed in 498d719 Apr 3, 2019
@Alhadis
Copy link
Collaborator

Alhadis commented Apr 3, 2019

Still couldn't reproduce the exact stack trace, but at this point, I'm pretty damn sure it's no longer an issue...

Figure 1

Figure 2 Figure 3

@dennisgaebel
Copy link

@Alhadis Thanks for the fix! 👍 🍻

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants