Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught error thrown in StyleManager.verifySheet #53

Closed
Dev-Lan opened this issue May 3, 2022 · 1 comment
Closed

Uncaught error thrown in StyleManager.verifySheet #53

Dev-Lan opened this issue May 3, 2022 · 1 comment
Assignees
Labels

Comments

@Dev-Lan
Copy link

Dev-Lan commented May 3, 2022

When I call taggle.setOverviewMode(...) I get an error thrown in the console:

The trace is:

taggle.setOverviewMode(...)
updateLodRules
GridStyleManager.updateRule
StyleManager.verifySheet
sheet.deleteRule()

The last line is where the error is thrown. https://github.com/lineupjs/lineupengine/blob/main/src/style/StyleManager.ts#L86

This appears to be caused by incorrectly deleting all the items in a list with a for loop.

const rules = sheet.cssRules;
...
const l = rules.length;
for (let i = 0; i < l; i += 1) { sheet.deleteRule(i); }

Suggested Fix
I have not tested this, but changing the loop logic should fix this.

while (sheet.cssRules.length > 0) { sheet.deleteRule(0); }

Screenshots
Notice how the error repeats, but the index listed is cut in half. This matches what I say above, half the items are deleted before getting to the end of the array, Then something (I don't know what) retriggered the code, and half the rules are deleted again.
image

Context

  • Version: 4.6.0
  • Browser: Chrome

Additional context

The ability to call setOverviewMode from a taggle object is new functionality, introduced in lineupjs/lineupjs#552. That might have exposed this error, but it is possible this could be triggered some other way.

@Dev-Lan Dev-Lan added the bug label May 3, 2022
@Dev-Lan
Copy link
Author

Dev-Lan commented May 3, 2022

Some more context.

I did find a couple of other actions that trigger the same error.

In overview mode selecting some rows:
image

In overview mode scrolling horizontally:
image

Repeating the user actions a few times will eventually clear out the cssRules, and things then appear to work correctly.

I was not able to trigger these when I used the overview toggle checkmark in the sidebar.

@sgratzl sgratzl mentioned this issue May 4, 2022
3 tasks
@sgratzl sgratzl self-assigned this May 4, 2022
@sgratzl sgratzl closed this as completed in 70add97 May 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants