JesusTheHun / storybook-addon-remix-react-router

Use your app router in your stories. A decorator made for Remix React Router and Storybook
Apache License 2.0
48 stars 11 forks source link

router not reloading component after change through SB controls #48

Closed Zebeqo closed 1 year ago

Zebeqo commented 1 year ago

I encounter this issue again in v2. #30

Here is my demo code.

import type { Meta, StoryObj } from "@storybook/react";
import { Outlet } from "react-router-dom";
import {
  reactRouterNestedAncestors,
  reactRouterParameters,
  withRouter,
} from "storybook-addon-react-router-v6";

const meta = {
  title: "Demo",
  decorators: [withRouter],
  parameters: {
    reactRouter: reactRouterParameters({
      routing: reactRouterNestedAncestors([
        {
          path: "/",
          element: (
            <div>
              Parent
              <Outlet />
            </div>
          ),
        },
      ]),
    }),
  },
} satisfies Meta;

export default meta;

export const Demo_: StoryObj<{
  test: string;
}> = {
  args: {
    test: "test",
  },
  render: ({ test }) => <div>{test}</div>,
};

I also created a repository if you want to check out the related dependencies.

JesusTheHun commented 1 year ago

@Zebeqo thanks for reporting this, once again !

I didn't test arg change through controls when the story IS the outlet. I'll have to create some tooling to make automated testing possible with this.

Anyway, I was able to reproduce and fixed it, for good I believe.

Zebeqo commented 1 year ago

@JesusTheHun Works great in our project, thanks a lot! 😊