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

Remove unused failureCallback in example #2650

Merged
merged 2 commits into from
Jun 23, 2021
Merged

Remove unused failureCallback in example #2650

merged 2 commits into from
Jun 23, 2021

Conversation

Atrox
Copy link
Contributor

@Atrox Atrox commented Jun 21, 2021

This is removing the unused and confusing failure callback in the example code. The text above the example is talking about the node callback convention with a single callback for success and error.

@facebook-github-bot
Copy link

Hi @Atrox!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks!

@netlify
Copy link

netlify bot commented Jun 21, 2021

✔️ Deploy Preview for react-native ready!

🔨 Explore the source changes: 4d94de6

🔍 Inspect the deploy log: https://app.netlify.com/sites/react-native/deploys/60d3824fc1e01e000852df60

😎 Browse the preview: https://deploy-preview-2650--react-native.netlify.app

@facebook-github-bot
Copy link

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

Copy link
Collaborator

@Simek Simek left a comment

Choose a reason for hiding this comment

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

Hi @Atrox, this example is a part of bigger section and shows an alternative approach to handling callbacks, as the paragraph above says:

There are two approaches to error handling with callbacks. The first is to follow Node’s convention and treat the first argument passed to the callback as an error object.

The example located above this one uses the single argument for callback.

Screenshot 2021-06-23 152708

@Atrox
Copy link
Contributor Author

Atrox commented Jun 23, 2021

Are you sure? The way I see it is that the first code block is incorrect. The whole parameter is unused in the code block. The next one seems to be correct because both of the parameters get used.

If not, I'm sorry for misunderstanding that part :) Feel free to close the PR.

image

@Simek
Copy link
Collaborator

Simek commented Jun 23, 2021

Oh, I see, you have edited the wrong file. In the next version (which is shown on my screenshot) examples are correct, but latest versioned docs (for 0.64) includes the incorrect callback. You need to revert the change in base docs and apply the fix to the correct example in:

There might be also some changes in corresponding paragraphs which also need to be back-ported. If you don't want to work on this changes please close this PR and I will look into this in soon. 🙂

@Atrox
Copy link
Contributor Author

Atrox commented Jun 23, 2021

It's a small fix so I can backport it without a problem if you need me to :). Just to clarify though, isn't that example also wrong in the next version? See my screenshot.

image

And if I look at my changed file (which is the next file, right?) it looks fine:

image

@Simek
Copy link
Collaborator

Simek commented Jun 23, 2021

To be honest the arrangement of examples in this section isn't that great and it's a bit confusing. There are some parts which can be definitely simplified. You are right that also in next the first occurrence of myFailureCallback can be omitted. The Native Modules section has been refactored and divided into multiple pages few months ago, and after looking at history it looks like this part was incorrectly copied during this process.

Thank you for your patience and catching this up! So the change in next can stay, please update the 0.64 doc file too and PR should be ready to merge. 🙂

Copy link
Collaborator

@Simek Simek left a comment

Choose a reason for hiding this comment

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

LGTM, thank you for the update! 🚀

@Simek Simek merged commit 03310df into facebook:master Jun 23, 2021
@Atrox Atrox deleted the patch-1 branch June 23, 2021 18:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants