storybook-addon-mock icon indicating copy to clipboard operation
storybook-addon-mock copied to clipboard

Uncaught TypeError: Object(...) is not a function looped error @ faker.js matchMock

Open hardfi opened this issue 2 years ago • 2 comments
trafficstars

Mocking requests works fine, but there's an infinite loop causing excessive resources usage, which prevents us from releasing code to server.

Screenshot 2023-01-02 at 14 40 31

Storybook configuration:

    "@dreamworld/addon-redux": "^1.1.0",
    "@storybook/addon-actions": "^6.5.15",
    "@storybook/addon-essentials": "^6.5.15",
    "@storybook/addon-links": "^6.5.15",
    "@storybook/preset-scss": "^1.0.3",
    "@storybook/react": "^6.5.15",
    "@storybook/storybook-deployer": "^2.8.16",
    "storybook-addon-mock": "3.2.0"

Downgrading to versions 3.1.0 and 3.0.0 did not help - with these versions story preview does not show at all (error). Before adding storybook-addon-mock everything worked as expected.

The callback function in matchMock method in esm/utils/faker.js receives '/runtime-error' as a parameter (url) but there is no request like this made anywhere by the app so I assume this is some Storybook internals.

The bug is quite serious because even navigating away from the story using the storybook-addon-mock does not stop the overflow.

I'd be very happy to see a solution/work-around for this issue as it prevents us from using our most crucial stories.

Thanks!

hardfi avatar Jan 02 '23 13:01 hardfi

happens for me as well with the latest version 4.0.0 and SB v.7

hanna-seraya avatar May 08 '23 22:05 hanna-seraya

@hanna-seraya @hardfi do you have any sandbox to reproduce this issue?

nutboltu avatar Jul 05 '23 12:07 nutboltu