Skip to content

test(ui): Return router props from initializeOrg#49372

Merged
scttcper merged 13 commits intomasterfrom
scttcper/init-org-router-props
Jun 16, 2023
Merged

test(ui): Return router props from initializeOrg#49372
scttcper merged 13 commits intomasterfrom
scttcper/init-org-router-props

Conversation

@scttcper
Copy link
Copy Markdown
Member

@scttcper scttcper commented May 17, 2023

Helps with the conversion of view tests to typescript.

Adds a generic that can correctly type view query parameters.

// For a component with RouteComponentProps<{alertId: string}, {}>
initializeOrg({router: {params: {alertId: '123'}}})

before

const {router, route, organization} = initializeOrg()
<Onboarding
  router={router}
  location={router.location}
  params={routeParams}
  routes={router.routes}
  routeParams={router.params}
  route={route}
/>

after

const {routerProps, organization} = initializeOrg()
<Onboarding {...routerProps} />

@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label May 17, 2023
@github-actions
Copy link
Copy Markdown
Contributor

This pull request has gone three weeks without activity. In another week, I will close it.

But! If you comment or otherwise update it, I will reset the clock, and if you label it Status: Backlog or Status: In Progress, I will leave it alone ... forever!


"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀

@scttcper scttcper marked this pull request as ready for review June 15, 2023 23:26
@scttcper scttcper requested a review from a team as a code owner June 15, 2023 23:26
@scttcper scttcper requested review from a team June 15, 2023 23:26
Copy link
Copy Markdown
Member

@priscilawebdev priscilawebdev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

left a few comments but it looks good to me. It was so verbose before and now it is much better! Thanks for doing that 🚀

* ```
*/
const routerProps: RouteComponentProps<RouterParams, {}> = {
params: router.params as any,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
params: router.params as any,
params: router.params as Record<string, any>,

🤷‍♀️

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it just gets overridden above with RouteComponentProps<RouterParams, {}>

Co-authored-by: Priscila Oliveira <priscila.oliveira@sentry.io>
@scttcper scttcper merged commit 1933148 into master Jun 16, 2023
@scttcper scttcper deleted the scttcper/init-org-router-props branch June 16, 2023 17:59
@scttcper scttcper added the Trigger: Revert Add to a merged PR to revert it (skips CI) label Jun 16, 2023
@getsentry-bot
Copy link
Copy Markdown
Contributor

PR reverted: 713e372

getsentry-bot added a commit that referenced this pull request Jun 16, 2023
This reverts commit 1933148.

Co-authored-by: scttcper <1400464+scttcper@users.noreply.github.com>
scttcper added a commit that referenced this pull request Jun 16, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Jul 2, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Scope: Frontend Automatically applied to PRs that change frontend components Trigger: Revert Add to a merged PR to revert it (skips CI)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants