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

feat: add new arch #119

Closed
wants to merge 6 commits into from
Closed

Conversation

WoLewicki
Copy link

PR converting module to TurboModule.

@ospfranco
Copy link
Owner

Thanks for the PR, would you care to explain what are the benefits on converting this to a turbo module? I can see some of the code aims to bring compatibility back with < 71 versions, but it is not clear to me if it is connected to all the turbo module changes

@@ -26,6 +26,10 @@ def isNewArchitectureEnabled() {
return project.hasProperty("newArchEnabled") && project.newArchEnabled == "true"
}

if (isNewArchitectureEnabled()) {
apply plugin: "com.facebook.react"
Copy link
Owner

Choose a reason for hiding this comment

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

when I was adding support for 0.71 this caused errors regarding duplicate symbols and caused conflicts with other libraries, is this correct?

Copy link
Author

Choose a reason for hiding this comment

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

I didn't see anything like this to be honest, and if I removed it, it seems like the codegen does not generate specs, so it is necessary 😅 You can see this step here too: https://github.com/react-native-community/RNNewArchitectureLibraries/tree/feat/back-turbomodule-070#turbomodule-set-up-buildgradle

}

@Override
public ReactModuleInfoProvider getReactModuleInfoProvider() {
Copy link
Owner

Choose a reason for hiding this comment

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

This looks complex, I guess it is necessary to register the turbomodule, can you explain a bit what it does? It looks like some kind of description

Copy link
Author

Choose a reason for hiding this comment

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

If you look deeper into that method, it is a kind of a description of the module. I didn't debug where it is used exactly though.

@WoLewicki
Copy link
Author

As for the benefits of the conversion, the install method should now be dispatched synchronously with the usage of JSI. Also, the module will be loaded lazily, but in this case it will still probably be at the startup of the application in most cases. As for the code for < 71 compat, I think I will remove it since you use prefabs, so it is not possible to use in < 71 anyway.

@ospfranco
Copy link
Owner

The install method was already synchronous though? And yes, indeed most of the time the time apps will initialize the module on app start...

While I do appreciate the effort in opening the PR it does introduce complexity and there is code there that doesn't seem to be documented anywhere, the old bridge implementation was straightforward, while the TurboModules require this complex setup

@WoLewicki
Copy link
Author

The install method was already synchronous though? And yes, indeed most of the time the time apps will initialize the module on app start...

It was synchronous but caused all the other queues to be blocked for during this method's dispatching iirc which is not the case with JSI I believe.

While I do appreciate the effort in opening the PR it does introduce complexity and there is code there that doesn't seem to be documented anywhere, the old bridge implementation was straightforward, while the TurboModules require this complex setup

I understand your point, but I wouldn't call this setup complex. It is still compatible with the old arch and makes the library subscribe to the newest changes and the future features of the framework.

@ospfranco
Copy link
Owner

The install method was already synchronous though? And yes, indeed most of the time the time apps will initialize the module on app start...

It was synchronous but caused all the other queues to be blocked for during this method's dispatching iirc which is not the case with JSI I believe.

But... any sync JS call will block anyways? am I misunderstanding something?

While I do appreciate the effort in opening the PR it does introduce complexity and there is code there that doesn't seem to be documented anywhere, the old bridge implementation was straightforward, while the TurboModules require this complex setup

I understand your point, but I wouldn't call this setup complex. It is still compatible with the old arch and makes the library subscribe to the newest changes and the future features of the framework.

But the library is already compatible with the old arch and with the new one, at least during my testing. Am I also wrong here?

I also really dislike turbo modules, this code generation step is, in my opinion, the wrong path, by skipping this I have complete control over how the module is initialized. I have to disagree to the point of it not being complex, that capabilities descriptor class on java looks über complicated and it is only referenced via source code to some example?

@ospfranco
Copy link
Owner

I also don't know what's the cost of initializing this module... I could guess it is very low since the bindings are not that large... but without numbers it is hard to tell if this is premature optimization

@WoLewicki
Copy link
Author

But... any sync JS call will block anyways? am I misunderstanding something?

It will block only the queue on which it will be dispatched imo.

But the library is already compatible with the old arch and with the new one, at least during my testing. Am I also wrong here?

You are right.

I also don't know what's the cost of initializing this module... I could guess it is very low since the bindings are not that large... but without numbers it is hard to tell if this is premature optimization

Yeah for sure. The main reason for this PR is subscribing to the newest solutions of the framework. I suspect there will be more things added to the TurboModules which will make them better.

@ospfranco
Copy link
Owner

really thorn on this... I will leave the PR open for now, the only real benefit IMO is somehow future-proofing the package and if I merge I will have to maintain it in the future which means keeping up with the kerfuffle of TurboModules for which I have no free time.

@WoLewicki
Copy link
Author

There is no hurry with it I believe. If you are not sure about the current benefits, I think it is OK just to leave this open and let people just use the version from this branch if they want it now.

@ospfranco ospfranco closed this Nov 9, 2023
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