MMM-Todoist icon indicating copy to clipboard operation
MMM-Todoist copied to clipboard

hideWhenEmpty not working

Open BoujeeBoba opened this issue 4 years ago • 5 comments

I have enabled the hideWhenEmpty parameter for this module but I can't get the header to disappear when the list is empty. The code in my config is setup as shown here:

{
		module: 'MMM-Todoist',
		position: 'top_left',	// This can be any of the regions. Best results in left or right regions.
		header: 'To Do List', // This is optional
		config: { // See 'Configuration options' for more information.
			hideWhenEmpty: true,
			accessToken: '...',
			maximumEntries: 5,
			updateInterval: 10*60*1000, // Update every 10 minutes
			fade: false,
			showProject:false,      
			//projects and/or labels is mandatory:
			projects: [ ... ] 
			//labels: [ "MagicMirror", "Important" ] // Tasks for any projects with these labels will be shown.
  			}
	},

I have waited for the mirror to refresh as well as start the mirror with an empty list and the header still appears, has anyone else run into this issue?

BoujeeBoba avatar Dec 10 '20 01:12 BoujeeBoba

Yup I have the same. End up having to leave a single item in the list. When this is used as a shopping list there can be a lot of milk bought when it isn't needed. :)

addfozzie avatar Jan 08 '21 22:01 addfozzie

the same problem !!!!I don't want to buy more milk !!! How could we make the header disappear? when the list is empty ...Thx!!

Rodriguezjp avatar Jan 26 '21 14:01 Rodriguezjp

I believe there's a related issue that can come up caused by the check of this.tasks.items.length on line 564 throwing an error because that value is undefined at the time. It was causing other widgets on my page to not render.

I'd love to throw in a PR, I just don't have a dev setup for working on MM modules right now, but if I can get one together I'll try and get a PR together.

ckboyle avatar Mar 09 '21 15:03 ckboyle

Same problem here. the check of this.tasks.items.length on line 564 causing other widgets on my page to not render. If I put false in "hideWhenEmpty" nothing is display on Todoist, but other widgets working.

Eagle2301 avatar Mar 10 '21 13:03 Eagle2301

Same here. When 'hideWhenEmpty: true' it throws

TypeError: Cannot read property 'items' of undefined at Class.getDom (MMM-Todoist.js:564)

`getDom: function () {

	if (this.config.hideWhenEmpty && this.tasks.items.length===0) {
		return null;
	}`

This prevents following modules to load. Workaround is to set 'hideWhenEmpty: false'

schramkef avatar Mar 19 '21 13:03 schramkef