Skip to content

Conversation

@ciampo
Copy link
Contributor

@ciampo ciampo commented Sep 11, 2024

What?

Add a runtime check in NavigatorScreen to warn consumers when the path prop doesn't follow the expected format

Why?

When the expected format is not used, Navigator doesn't behave as expected (see, for example, #65109). A runtime check is one more way that we can help consumers of Navigator to use the component as expected.

How?

If the path doesn't start with /, output a warning to console.

Testing Instructions

In dev mode, in the editor try changing the path of a NavigatorScreen component and remove the leading / — a warning should be printed to console.

The new unit test should pass.

@ciampo ciampo requested a review from ajitbohra as a code owner September 11, 2024 08:28
@ciampo ciampo requested review from a team, andrewserong and t-hamano September 11, 2024 08:28
@github-actions
Copy link

github-actions bot commented Sep 11, 2024

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: ciampo <[email protected]>
Co-authored-by: Mamaduka <[email protected]>
Co-authored-by: ramonjd <[email protected]>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@ciampo ciampo self-assigned this Sep 11, 2024
@ciampo ciampo requested a review from ramonjd September 11, 2024 08:28
@ciampo ciampo added [Type] Enhancement A suggestion for improvement. [Package] Components /packages/components labels Sep 11, 2024
Copy link
Member

@Mamaduka Mamaduka left a comment

Choose a reason for hiding this comment

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

Thank you, @ciampo!

Copy link
Member

@ramonjd ramonjd left a comment

Choose a reason for hiding this comment

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

I have been warned! LGTM

Screenshot 2024-09-11 at 6 33 04 PM

@ciampo ciampo disabled auto-merge September 11, 2024 08:35
@ciampo ciampo enabled auto-merge (squash) September 11, 2024 08:35
@ciampo ciampo merged commit 5daa582 into trunk Sep 11, 2024
@ciampo ciampo deleted the feat/navigator-runtime-check branch September 11, 2024 09:05
@github-actions github-actions bot added this to the Gutenberg 19.3 milestone Sep 11, 2024
@github-project-automation github-project-automation bot moved this to In progress (owned) ⏳ in WordPress Components Aug 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Package] Components /packages/components [Type] Enhancement A suggestion for improvement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants