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

fix(chakra-ui): add meta to ShowButton Props #6740

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

arndom
Copy link
Contributor

@arndom arndom commented Apr 3, 2025

  • add changeset

PR Checklist

Please check if your PR fulfills the following requirements:

Bugs / Features

What is the current behavior?

meta doesn't impact URL in chakra-ui show button

What is the new behavior?

meta now impacts URL in chakra-ui show button

fixes (issue)
#6707

Notes for reviewers

@arndom arndom requested a review from a team as a code owner April 3, 2025 14:43
Copy link

netlify bot commented Apr 3, 2025

Deploy Preview for refine-doc-live-previews ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 57cf972
🔍 Latest deploy log https://app.netlify.com/sites/refine-doc-live-previews/deploys/67ee9eb14cbe9600082f161c
😎 Deploy Preview https://deploy-preview-6740--refine-doc-live-previews.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@arndom
Copy link
Contributor Author

arndom commented Apr 3, 2025

I had attempted to write a test for this, to the ui-tests/src/tests/buttons/show.tsx shared by all ShowButtons but it kept failing, even though it should be correct.

Could something be wrong with my implementation? Here is the code:

    it("should go to show page with id coming from meta", async () => {
      const { getByText } = render(
        <Routes>
          <Route
            path="/:resource"
            element={
              <ShowButton
                recordItemId="1"
                meta={{
                  authorId: "10",
                }}
              />
            }
          />
        </Routes>,
        {
          wrapper: TestWrapper({
            resources: [
              {
                name: "posts",
                list: "/posts",
                show: "/posts/:authorId/show/:id",
              },
            ],
            routerInitialEntries: ["/posts"],
          }),
        },
      );

      await act(async () => {
        fireEvent.click(getByText("Show"));
      });

      expect(window.location.pathname).toBe("/posts/10/show/1");
    });

This test case is important because the master branch(what I previously based my fork on) already had the meta prop passed, but at some point the main branch had it removed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant