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

Window resize only doesn't do the trick #560

Open
hotNipi opened this issue Feb 9, 2024 · 2 comments
Open

Window resize only doesn't do the trick #560

hotNipi opened this issue Feb 9, 2024 · 2 comments
Labels
bug Something isn't working size:S - 2 Sizing estimation point task A piece of work that isn't necessarily tied to a specific Epic or Story.

Comments

@hotNipi
Copy link

hotNipi commented Feb 9, 2024

Description

For window size if there is enough space the sidebar renders into the layout (not above), if to toggle the sidebar, the cards change their size accordingly. Any widget (like ui_gauge) using window resize event to update it's content are out of shape cos of course - the window size is not changed.

So it maybe needs to dispatch the resize forcibly window.dispatchEvent(new Event('resize')); when sidebar animation completes. Don't know if there is more such internal layout changes which then may need same sort of treatment.

Best,
Endel

Epic/Story

No response

Have you provided an initial effort estimate for this issue?

I can not provide an initial effort estimate

@hotNipi hotNipi added the task A piece of work that isn't necessarily tied to a specific Epic or Story. label Feb 9, 2024
@joepavitt
Copy link
Collaborator

Thanks Endel, great spot. Will investigate

@joepavitt joepavitt added size:S - 2 Sizing estimation point bug Something isn't working labels Feb 9, 2024
@hotNipi
Copy link
Author

hotNipi commented Feb 9, 2024

The workaround or why not the suggestion for creators would be to use ResizeObserver

 mounted(){  

        this.resizeObserver = new ResizeObserver((entries) => {
            this.onResize()
        });
        this.resizeObserver.observe(this.$refs['your-ref-name']);        
    },
 unmounted () {
        if(this.resizeObserver){
            this.resizeObserver.disconnect();
            this.resizeObserver = null;            
        }
    },

Can't say about the how it affects the overall performance ..

EDIT:

Tested with my custom gauges and works well.Updated code also in forum so can be used for testing.
https://discourse.nodered.org/t/dashboard-2-0-is-now-generally-available/84913/84?u=hotnipi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working size:S - 2 Sizing estimation point task A piece of work that isn't necessarily tied to a specific Epic or Story.
Projects
Status: Up Next
Development

No branches or pull requests

3 participants