-
-
Notifications
You must be signed in to change notification settings - Fork 120
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
ResizerService callback exception even with enableAutoResize=false #836
Comments
Oh ok that is a lot of info here, this extra resize with a 10ms delay was introduced to try to help/fix #820 (which I couldn't replicate so it's hard to fix that), the delay was in the previous version 2.x but it caused me problems on my project side (with the As for the The Resizer Observer seems interesting, I wonder if that would fix our problem, if you think it does then please go ahead with a PR. I also wanted to eventually get rid of the So yeah PRs are always welcome from you and I like your coding practices too, so totally open for PRs and discussions. |
@jr01 in regards to the PR you made in Slickgrid-Universal, would it be possible to add some details to describe the new option and how to use it in the Angular-Slickgrid - auto-resize Wiki? The Wikis are public, so you should be able to edit the Wiki straight away, it would be helpful for me and others to understand the changes/options. Thanks again for the PR, I'm expecting a release tomorrow (Wednesday evening) |
Yes I'll do that. |
@jr01 |
I see you updated the Wiki, thanks for that, I updated the Release with the new link. Thanks for all the contributions you made, it's very much appreciated, it's rare to have good contributors like you and that helps on the motivation side to continue with the lib 😉 |
I'm submitting a Bug report
Your Environment
Describe the Bug
After upgrading to 3.10 one of our component UI tests consistently fails with:
Steps to Reproduce
This appears to happen when Angular SlickGrid is loaded and then gets unloaded/destroyed within 10ms. In our case a UI-test opens a page where Angular Slickgrid is shown and immediately navigates to another page.
I'm not sure why this occurs on 3.1.0 and didn't before, perhaps 3.1.0 initializes faster.
Expected Behavior
No exception should occur. And also I wouldn't expect this code to be executed at all since we're running with
enableAutoResize=false
.Current Behavior
See above.
Possible Solution
The exception is caused by the 2nd resize here https://github.com/ghiscoding/slickgrid-universal/blob/master/packages/common/src/services/resizer.service.ts#L159:
which executes the resize in a setTimeout(..., 10). The callback doesn't check if Slickgrid still exists.
As mentioned I wouldn't expect this code to be executed because we set
enableAutoResize=false
.For a fix, my thought is to add a condition in
init
here https://github.com/ghiscoding/slickgrid-universal/blob/master/packages/common/src/services/resizer.service.ts#L121:If you want I can create a PR on the universal repo for that. (PR 1)
I also noticed that when
enableAutoResize=true
thebindAutoResizeDataGrid
gets called frombindResizeHook
here: https://github.com/ghiscoding/Angular-Slickgrid/blob/master/src/app/modules/angular-slickgrid/components/angular-slickgrid.component.ts#L1049, so it appears in that case resize binding is done 2x and I think that is a separate bug and I can create a separate PR for that (PR 2).I have found a workaround, but I should say first that we've been running without the Angular Slickgrid resizer for a while and are using a
https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserver
because of a bug where the browser doesn't trigger the$(window).on(
resize.grid${this.gridUidSelector}callback, but a
ResizeObserver` does trigger things.... I haven't gotten around to investigate that further. Anyway this is roughly the code & workaround we have in place now:... and I noticed the
resizeGridWhenStylingIsBrokenUntilCorrected
workaround ... and I wanted to mention that we have a pretty similar scenario with a grid inside of a tab and user switching between tabs and resizing and I haven't seen that problem using theResizeObserver
approach...so perhaps we could create a PR (PR 3) with a new option
gridOptions.autoResizeOptions.useResizeObserver = true
that whenautoResizeEnabled=true
would then use theResizeObserver
and no other workarounds.With PR 1 + PR 2 + PR 3 I should then be able to completely remove any resizing workarounds from our code 😎
Code Sample
Sorry, I have no code sample. I can try to create one if needed of course.
The text was updated successfully, but these errors were encountered: