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

Fixing release-only crash for when specifying validKeys[Down|Up] #1883

Merged
merged 2 commits into from
Jul 17, 2023

Conversation

nakambo
Copy link
Collaborator

@nakambo nakambo commented Jul 17, 2023

Please select one of the following

  • I am removing an existing difference between facebook/react-native and microsoft/react-native-macos 👍
  • I am cherry-picking a change from Facebook's react-native into microsoft/react-native-macos 👍
  • I am making a fix / change for the macOS implementation of react-native
  • I am making a change required for Microsoft usage of react-native

Summary

Wrong macro -- use RCT_ARRAY_CONVERTER, not RCT_JSON_ARRAY_CONVERTER. The latter is for "directly representable json array values that require no conversion.":

/**
 * This macro is used for creating converter functions for directly
 * representable json array values that require no conversion.
 */
#if RCT_DEBUG
#define RCT_JSON_ARRAY_CONVERTER_NAMED(type, name) RCT_ARRAY_CONVERTER_NAMED(type, name)
#else
#define RCT_JSON_ARRAY_CONVERTER_NAMED(type, name) \
  +(NSArray *)name##Array : (id)json               \
  {                                                \
    return json;                                   \
  }
#endif
#define RCT_JSON_ARRAY_CONVERTER(type) RCT_JSON_ARRAY_CONVERTER_NAMED(type, type)
/**
 * This macro is used for creating converter functions for typed arrays.
 * RCT_ARRAY_CONVERTER_NAMED may be used when type contains characters
 * which are disallowed in selector names.
 */
#define RCT_ARRAY_CONVERTER(type) RCT_ARRAY_CONVERTER_NAMED(type, type)

Changelog

[GENERAL] [FIXED] - Initial commit

Test Plan

No more crashing. Verified we properly call the converter for release

Wrong macro -- use `RCT_ARRAY_CONVERTER`, not `RCT_JSON_ARRAY_CONVERTER`. The latter is for "directly representable json array values that require no conversion.":

`/**
 * This macro is used for creating converter functions for directly
 * representable json array values that require no conversion.
 */
  +(NSArray *)name##Array : (id)json               \
  {                                                \
    return json;                                   \
  }

`/**
 * This macro is used for creating converter functions for typed arrays.
 * RCT_ARRAY_CONVERTER_NAMED may be used when type contains characters
 * which are disallowed in selector names.
 */
@nakambo nakambo requested a review from a team as a code owner July 17, 2023 22:54
@nakambo nakambo enabled auto-merge (squash) July 17, 2023 22:57
@nakambo nakambo merged commit e2dbf40 into main Jul 17, 2023
17 of 18 checks passed
@nakambo nakambo deleted the user/nakambo/fix-key-release-crash branch July 18, 2023 01:37
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.

2 participants