Skip to content

setupSizeChangedNotifications reports size before content is ready, causing widgets to collapse #143

Open

Description

@chelojimenez

Describe the bug
The setupSizeChangedNotifications() method measures and reports size immediately when connect() completes. For widgets with async content (maps, data fetches, etc.), this captures the loading state dimensions rather than the final rendered size.

if (this.options?.autoResize) {                  
    this.setupSizeChangedNotifications();  //      
  Called immediately after connect                 
  }  

To Reproduce
Connect https://open-sky-mcp.kontakt-e7d.workers.dev/mcp (repo) to MCPJam and observe. More context in this thread

Notes
From what I notice (but i could be wrong):

  1. Widget connects → shows "Waiting for flight data..." spinner
  2. SDK immediately measures → reports height 110px (just the spinner)
  3. Host sets iframe to 110px
  4. Map data loads, but container is now only 110px
  5. Map has no space to render → invisible

Activity

  1. Mohammedsapry commented on Dec 17, 2025

    @Mohammedsapry

    Why

  2. kashtian commented on Mar 26, 2026

    @kashtian

    I also ran into this issue. The reason is that setupSizeChangedNotifications sets html.style.width = "fit-content" and html.style.height = "max-content".
    Because of this, if a child element uses height: 100%, the height detection may become inaccurate.

  3. ochafik commented on Apr 21, 2026

    @ochafik
    Contributor

    Update: as of #622 you can pass useApp({ autoResize: false }) (or new App(appInfo, caps, { autoResize: false })) and call app.sendSizeChanged() yourself once your async content has rendered — that sidesteps the early-measurement collapse without touching the default measurement logic.

    A change to the measurement itself (#619) is on hold pending cross-host validation, since it affects every existing app's resize behavior.

  4. Mohammedsapry commented on Jul 6, 2026

    @Mohammedsapry

    if (this.options?.autoResize) {
    this.setupSizeChangedNotifications(); //
    Called immediately after connect
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions