Skip to content

Conversation

@tjzel
Copy link
Collaborator

@tjzel tjzel commented Nov 7, 2025

Summary

Granular PR for the ease of review of refactor of some of Serializables native code, extracted from #8555.

Test plan

CI

Comment on lines +9 to +12
jsi::Value makeSerializableString(jsi::Runtime &rt, const jsi::String &string) {
const auto serializable = std::make_shared<SerializableString>(string.utf8(rt));
return SerializableJSRef::newNativeStateObject(rt, serializable);
}
Copy link
Member

Choose a reason for hiding this comment

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

How about converting these function into several makeSerializable static methods with different argument types?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is my long-term plan but for the atomic PRs and ease of review I decided to move it to a separate file for now.

: BaseClass(rt, std::forward<Args>(args)...), primaryRuntime_(&rt) {}

jsi::Value toJSValue(jsi::Runtime &rt);
jsi::Value toJSValue(jsi::Runtime &rt) {
Copy link
Member

Choose a reason for hiding this comment

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

What's the reason for having this function inlined? It makes debugging more challenging and historically we had a serious bug right in this place.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It's a method of a generic class so it must be available for the compilation units which need it. Previously the only compilation units that needed the definition were in Serializable.cpp so they had access to the template. Now that the functions were moved to SerializableFactory.h/cpp they need to have access to the template through the header file.

Base automatically changed from @tjzel/cpp-lint-fix to main November 20, 2025 09:17
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