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: doclinks should not select a default platform #1882

Merged

Conversation

blakef
Copy link
Contributor

@blakef blakef commented Mar 21, 2023

Previously this would default to Android, which isn't intuitive. Also fixed some links to be more specific.

Summary:

Before

CleanShot 2023-03-21 at 10 15 43

After

CleanShot 2023-03-21 at 10 13 35

Test Plan:

Built and ran the cli to init a new project.

@blakef blakef requested review from adamTrz and thymikee as code owners March 21, 2023 10:18
@blakef blakef changed the title fix: doclinks don't select a default platform fix: doclinks should not select a default platform Mar 21, 2023
Comment on lines 66 to 80
if (platform) {
url.searchParams.set('platform', platform);
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't have context on this code, but is there a way we can force relevant call sites to specify a platform where one is needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure I understand the question, but giving it a go. In some places where we take care of this. For example when the user runs npx react-native run-android, we set the platform to android.

Is that what you're asking about?

Copy link
Collaborator

Choose a reason for hiding this comment

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

What I mean is: Is it useful that platform is optional on line 31? Could we, for example, make it required in every call to doclink?

Copy link
Member

Choose a reason for hiding this comment

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

I agree. There are places where platform would be helpful and is missing (e.g. runBundleInstall.ts). Can we make platform mandatory and allow null or "none" as an input when it's not necessary? I believe it should help anyone at least consider whether nulling the platform is correct choice

@github-actions
Copy link

There hasn't been any activity on this pull request in the past 3 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 7 days.

@github-actions github-actions bot added the stale label Jun 20, 2023
@thymikee
Copy link
Member

@blakef would you mind revisit this PR and check the suggestions?

@blakef
Copy link
Contributor Author

blakef commented Jun 20, 2023

Thanks for the nudge @thymikee. I'll take a look at it.

Previously this would default to Android, which isn't intuitive. Also
fixed some links to be more specific. The new api is:

  link.docs(<path>, <platform>)

For platforms your choices are:
 - ios
 - android
 - none -> drop the platform parameter if the docs don't have any
   platform specific relevance.
 - inherit -> use this if you have to `link.setPlatform` before hitting
   a cli-command (will assert and fail at runtime if you haven't). See
   the `upgrading` command for an example.
@blakef blakef force-pushed the fix-doclinks-no-default-platform branch from ddfc176 to 5b1af3f Compare June 20, 2023 11:09
@blakef blakef requested a review from motiz88 June 20, 2023 12:16
@github-actions github-actions bot removed the stale label Jun 21, 2023
@blakef
Copy link
Contributor Author

blakef commented Jun 28, 2023

@thymikee I think we're GTG.

Copy link
Member

@thymikee thymikee left a comment

Choose a reason for hiding this comment

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

🚀

@thymikee thymikee merged commit 0d118e3 into react-native-community:main Jun 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants