SimeonC / storybook-xstate-addon

A storybook addon to assist with writing stories that rely on xstate
https://SimeonC.github.io/storybook-xstate-addon/
MIT License
54 stars 6 forks source link

Height problems #45

Open TheKnarf opened 1 year ago

TheKnarf commented 1 year ago
Screenshot 2022-10-27 at 22 44 33

Why doesn't it fill the whole height of the pane?

SimeonC commented 1 year ago

Hi, I can't replicate it on the demo site so I'm going to need some more details from you please 🙇

TheKnarf commented 1 year ago

package.json:

{
  "name": "frontend",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "dev": "next dev",
    "build": "next build",
    "start": "next start",
    "lint": "next lint",
    "start:storybook": "cross-env STORYBOOK_DISABLE_TELEMETRY=1 start-storybook -p 6006",
    "build:storybook": "cross-env STORYBOOK_DISABLE_TELEMETRY=1 build-storybook"
  },
  "dependencies": {
    "@xstate/react": "^3.0.1",
    "next": "13.0.0",
    "react": "18.2.0",
    "react-dom": "18.2.0",
    "xstate": "^4.33.6"
  },
  "devDependencies": {
    "@babel/core": "^7.19.6",
    "@mdx-js/react": "^1.6.22",
    "@storybook/addon-actions": "^6.5.13",
    "@storybook/addon-docs": "^6.5.13",
    "@storybook/addon-essentials": "^6.5.13",
    "@storybook/addon-interactions": "^6.5.13",
    "@storybook/addon-links": "^6.5.13",
    "@storybook/builder-webpack5": "^6.5.13",
    "@storybook/manager-webpack5": "^6.5.13",
    "@storybook/react": "^6.5.13",
    "@storybook/testing-library": "^0.0.13",
    "@types/node": "18.11.7",
    "@types/react": "18.0.24",
    "@types/react-dom": "18.0.8",
    "@xstate/inspect": "^0.7.0",
    "babel-loader": "^8.2.5",
    "cross-env": "^7.0.3",
    "eslint": "8.26.0",
    "eslint-config-next": "13.0.0",
    "storybook-xstate-addon": "^2.3.1",
    "typescript": "4.8.4"
  }
}

https://github.com/TheKnarf/storybook-xstate-test

HakimCh commented 1 year ago

Hi @SimeonC, @TheKnarf,

I had the same issue, it's introduced with the v2.3.1 version.

SimeonC commented 1 year ago

Thanks for the reproduction, I think this may be related to a storybook internal change as all 2.3.0 changed was the peer dependencies (2.3.1 was weird as it shouldn't have done a release, there's no code changed in that version).

I think the issue was I was waiting in internal storybook render timings to set the height and should change this to rely on a mutation listener to set the height instead. Setting the height to 100% has some weird cases that it doesn't update the height

Due to work pressures it might be a while before I can get around to fixing it but I'm happy to review and merge a PR fixing it if anyone can get it done earlier.

SimeonC commented 1 year ago

Thanks to @HakimCh this should be fixed in 2.3.3. It's on NPM but it looks like some permissions or something have changed since the last time I ran a release so all the other automation like notifying this ticket failed.

TheKnarf commented 1 year ago

I've updated my test repo to version 2.3.6. The problem seems to still preserve. Please re-open the issue.

SimeonC commented 1 year ago

Thanks, had some time today so I booted up a code sandbox to investigate. It looks like there have been some extra divs being added which aren't filling the space correctly.

CleanShot 2022-11-18 at 18 06 28

steveoh commented 1 year ago

Is anyone picking this up to fix?

SimeonC commented 1 year ago

I haven't time to pick it up till late January due to family/work I don't think. Open for PRs.

steveoh commented 1 year ago

I looked at the code and I'm not sure how it can be done. There's a div above what it seems this loads that we don't have control over and can't set a height on. But if I set a height in code the entire machine disappears so ¯_(ツ)_/¯. I've resorted to adding height:100 to the div in the picture above.

SimeonC commented 1 year ago

Did a quick search around and I think this might be related to this issue https://github.com/storybookjs/storybook/issues/17818

It looks like the related PR might fix this problem as well.