resoai / TileBoard

A simple yet highly configurable Dashboard for HomeAssistant
MIT License
1.63k stars 278 forks source link

Hidden Property In Pages #705

Open brandona34 opened 3 years ago

brandona34 commented 3 years ago

Hi, I think I may have uncovered a bug in the engine that shows / hides pages.

I have an Tileboard instance that I've been running for the past few years with five pages A, B, C, D, E. Recently, I decided to hide a page I don't use often (B) so I wanted to dynamically show or hide it based on a sensor value. After I made the change I noticed some erratic behavior, so I disabled the dynamic update function code and stuck to some simple boolean values (i.e. "hidden: true," and "hidden: false" and was able to reproduce the issue.

If under the parameters the page object for Page B, i add a "hidden: false" key, all the icons and corresponding pages show up correctly on my dashboard.

ICON -> CORRESPONDING PAGE SHOWN WHEN ICON CLICKED
A -> A
B -> B
C -> C
D -> D
E -> E

But if it to "hidden: true" I get a mismatch between the pages and the icons that show up for the pages. I get something like the following:

ICON -> CORRESPONDING PAGE SHOWN WHEN ICON CLICKED
A -> A
C -> D
D -> E
E -> (blank page with solid background)

I have hidden attributes throughout the pages that are on tiles and tile groups and they all work as expected. Seems to be isolated to pages. Is this an issue, or might I be missing something?

PS> Pulled the latest version (v2.5) in earlier today before I made the updates.

akloeckner commented 3 years ago

I'd say it's breaking here: https://github.com/resoai/TileBoard/blob/94a184604d6f2659a4a6ed1b82f626b7e6affdd9/scripts/controllers/main.js#L1836

The scroll position is calculated using all pages. But the hidden page B is not drawn at all, as of here, I believe: https://github.com/resoai/TileBoard/blob/236c2d5a4bd9ab893d3ceb5dec54b5c5f9de8f75/index.html.ejs#L247

So, the scroll position points to the wrong location in the page...