Skip to content

Tag disabled returns undefined on getModules() #2382

@ezeholz

Description

@ezeholz

I found a bug in MagicMirror

Please make sure to only submit reproducible issues. You can safely remove everything above the dividing line.
When submitting a new issue, please supply the following information:

Platform: VM Ubuntu 18.04 and Jopyth/MMM-Remote-Control#242 (comment)
Electron installed with MM version.

Node Version: v14.15.0

MagicMirror Version: v2.13.0

Description: MagicMirror gives identifiers and a place inside getModules() array to modules that are disabled with the disabled tag.

Steps to Reproduce:

  1. Install MagicMirror Manually
  2. Add the disabled: true, tag inside any default module. Tried in news module.
  3. Start MM with npm start
  4. In Electron, open dev console using CTRL + SHIFT + I and write MM.getModules()

Expected Results: You should see every module described as a class, and those modules that are disabled should never be returned. Not even as undefined

Actual Results:
image
You see not only above but in the numbers and identifiers that the number 5 is skipped as an identifier and as an integer in the array.

Configuration:

/*************** AUTO GENERATED BY REMOTE CONTROL MODULE ***************/

var config = 
{
  address: '0.0.0.0',
  electronOptions: {
    fullscreen: false
  },
  ipWhitelist: [],
  modules: [
    {
      module: 'MMM-Remote-Control',
      position: 'top_right',
      header: '',
      config: {
        showModuleApiMenu: true,
        customMenu: 'custom.json',
        secureEndpoints: false,
        classes: {
          test: {
            toggle: 'calendar'
          },
          'This is a test': {
            hide: [
              'calendar',
              'newsfeed'
            ],
            toggle: 'clock'
          },
          'this is another test': {
            show: [
              'calendar',
              'newsfeed'
            ],
            hide: [
              'clock'
            ]
          }
        }
      }
    },
    {
      module: 'updatenotification',
      position: 'top_bar',
      config: {}
    },
    {
      module: 'clock',
      position: 'top_left',
      header: '',
      config: {}
    },
    {
      module: 'calendar',
      header: 'US Holidays',
      position: 'top_left',
      config: {
        calendars: [
          {
            symbol: 'calendar-check',
            url: 'webcal://www.calendarlabs.com/ical-calendar/ics/76/US_Holidays.ics'
          }
        ]
      }
    },
    {
      module: 'compliments',
      position: 'lower_third',
      classes: 'test',
      config: {}
    },
    {
      module: 'newsfeed',
      position: 'bottom_bar',
      disabled: true, // Here it's the disabled module
      config: {
        feeds: [
          {
            title: 'New York Times',
            url: 'https://rss.nytimes.com/services/xml/rss/nyt/HomePage.xml'
          }
        ]
      }
    },
    {
      module: 'alert',
      header: '',
      config: {
        welcome_message: true
      }
    }
  ],
  useHttps: false,
  httpsPrivateKey: '',
  httpsCertificate: '',
  logLevel: [
    'INFO',
    'LOG',
    'WARN',
    'ERROR'
  ]
}

/*************** DO NOT EDIT THE LINE BELOW ***************/
if (typeof module !== 'undefined') {module.exports = config;}

Additional Notes: This could break code if the developers iterate above the MM.getModules() and brings the identifier from an undefined module.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions