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

Editor clobbers _alwaysOnWidgetColumns when mixed-in with ColumnSet #1412

Closed
scotth7447 opened this issue Jan 30, 2018 · 2 comments · Fixed by #1455
Closed

Editor clobbers _alwaysOnWidgetColumns when mixed-in with ColumnSet #1412

scotth7447 opened this issue Jan 30, 2018 · 2 comments · Fixed by #1455
Assignees
Labels

Comments

@scotth7447
Copy link

Editor._configColumns() sets this._alwaysOnWidgetColumns = [], and then pushes columns onto that array in _configureEditorColumn() for always-on edit columns.

ColumnSet.configStructure() calls this._configColumns() multiple times, once per item in this.columnSets.

When you have a grid with both ColumnSet and Editor mixedin, Editor clobbers the this._alwaysOnWidgetColumns array for the first (n-1) column sets. This means that when removing a row in removeRow(), it is not aware of the editor widgets in the first (n-1) column sets and does not destroy them. It properly disposes of the editor widgets for the cells in the last column set only. This results in a memory/widget leak in the registry.

I'm currently using dgrid 1.1.0, but I checked the latest source on github and it doesn't look like this has been noticed/fixed yet. I searched before submitting this issue and didn't see it mentioned.

@edhager edhager self-assigned this Feb 1, 2018
@edhager
Copy link
Contributor

edhager commented Feb 1, 2018

I am working on a fix in this branch: https://github.com/edhager/dgrid/tree/editor-columnset-clobber-fix-1412

So far the unit tests pass. I'm going to write some more unit tests that combine Editor and ColumnSet and looks for memory leaks.

If you try out my branch, let me know if it works for you or not.

@edhager edhager added the bug label Feb 1, 2018
@scotth7447
Copy link
Author

Thanks for fixing this! However, I have two questions:

  1. Doesn't this only work if you declare the grid with declare([Grid, ColumnSet, Editor])? I think it will fail with declare([Grid, Editor, ColumnSet]) because ColumnSet.configStructure() calls Editor._configColumns() before it calls this.inherited(arguments). Would doing so violate a standard practice for dgrid mixin order?

  2. Does a similar fix need to be made for Tree._configColumns(), which also resets an instance property: this._expanded = {} - in the latest code, by calling this._resetExpanded()? I have never used Tree, so I do not know if it is compatible with ColumnSet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants