-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Resized event is called too many times #358
Comments
I want also add that a moved property is added on layout updated event. A solution could be to add a resized property too. |
I'm finding this event a little confusing too. Really I'd like it to fire when the user finishes resizing the grid item so that I can save the new layout in my database. |
Same here. Check this, 8886f3a |
This was introduced by PR #337, that I submitted. I included a discussion there about the merits of the same vs different event names. Perhaps the wrong choice was made there. Perhaps when resizing the window another event entirely should be emitted, or perhaps the event data should contain a flag indicating why the event was fired. At least I explicitly mentioned this in the PR :-) I tried to look at https://codesandbox.io/s/vue-template-1vcqv?fontsize=14
Is there a working codesandbox.io? However, example 2 is working, and yes, two The problem before was that only the first one was emitted; before the grid-item got its final size. |
Yes, looking back now probably not the smartest move keeping the event with the same name. I'll work on changing it in the next release. |
There is at least one more problem. The resized event contains pixel sizes. Either they should be correct or they should be omitted. As it is now, the pixel sizes in the first batch of resized events are just plain wrong. Let's say we rename the events I introduced to pixelresized events. Then first there would be resized events with bogus pixel sizes and then pixelresized events with correct pixel sizes. I think the real problem is that two sets of events are emitted during mounting. There should be a single set of resized (or pixelresized) events emitted with correct pixel sizes, and it should be emitted after the layout has stabilized. After mount, it would be fine if pixelresized events are emitted when only pixel sizes change. |
If it helps at all, here's my use cases for 2 different types of resize event;
I can't personally see a use case for either of these firing on page load / first mount. |
@mattgreenfield: Don't you need to initialize Leaflet with an initial pixel size? If no events fire at initial load, how do you know when to initialize leaflet and with which pixel size? |
@gmsa is there any possibility to totally disable resized event? |
@rin4ik what exactly is the problem you're having with the event? |
@gmsa I am using a layout-updated event only for changing widgets. I am worried about performance because a lot of events fired on initial load and afterward when dragging and resizing grid items. would be great to have a possibility to disable those events if they are not used for the layout-updated event. for my use case, I only need breakpoint-changed and layout-updated events. this would be a great performance boost |
Unless you have hundreds of widgets, shouldn't be a problem |
Software version (please complete the following information):
Describe the bug
In documentation you said that resizedEvent is called 'Every time an item is finished being resized and changes size'.
However after some tests it seems that resized event is called too many times.
For example on layout creation and also when I start resizing and during resizing.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
ResizedEvent should be called when user stop to resize and lift the resize handler. Otherwise I don't have any clue when a resize action is ended.
A solution can be to have a resizeStop event.
Check this: https://codesandbox.io/s/vue-template-1vcqv?fontsize=14
The text was updated successfully, but these errors were encountered: