Programmatic retrieval of layers' visibility always returns `true`
Question
Hello again :)
Our team might have found a bug while using the Layer Manager API: every call to component.viewLayer.isVisible() seems to always return true, regardless of their actual state.
Steps to reproduce:
- Open the demo
- Switch to the layers panel
- Click on the eye icon to hide the "Body" layer
- Open the console
- Executing
editor.getWrapper().viewLayer.isVisible()returns1instead offalse
Looking at the code, I believe this.model.getStyle() should be used instead of this.model.get('style') (which always returns {}) to retrieve the current display value.
As always, I'd be happy to open a PR to fix it !
Cheers :)
Answers (2)
Yeah, you're totally right, the PR is welcome :)
Great ! #2879 opened.
Related Questions and Answers
Continue research with similar issue discussions.
Issue #2637
[Bug]: Preview mode & automatic components borders toggling
Hello again :) Our team recently started customising the editor & removing the webpage preset, and we might have found some bugs related to...
Issue #2636
[Bug]: Custom panels not hidden in preview mode
Hello again :) Our team recently started customising the editor & removing the webpage preset, and we might have found some bugs related to...
Issue #5378
Uncaught TypeError: Cannot read properties of undefined (reading 'Canvas') while dragging a component in Layer Manager Panel
GrapesJS version [X] I confirm to use the latest version of GrapesJS What browser are you using? Chrome v116.0.5845.97 Reproducible demo li...
Issue #3005
BUG: Layer manager appendTo is duplicating the layers every time grapesjs is init
Version: 0.16.18 and up (The issue was introduced somewhere after 0.15.3, not sure when) Are you able to reproduce the bug from the demo? [...
Paid Plugins That Match This Issue
Curated by issue keywords and label relevance to help you ship faster.
Loading paid plugin recommendations...
Check the open-source GrapesJS plugins on GitHub or run a quick search in our free catalog.
Browse free plugins →Premium plugins ship with support, regular updates, and production-ready features — save days of integration work.
Browse premium plugins →Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.