ZupIT / nimbus-compose

Library for enabling Server Driven UI in Jetpack Compose
Apache License 2.0
19 stars 8 forks source link

Feat: auto component deserialization + fix to slow view updates #28

Closed Tiagoperes closed 2 years ago

Tiagoperes commented 2 years ago

Auto component deserialization

This is the first step towards a simple to use API that allows for the user to declare its composable functions and not need to do anything else.

With this, any composable function can be registered via:

val myComponentLibrary = ComponentLibrary("namespace")
  .add("myComponent") @Composable { MyComponent(it) }

There's no need for manual deserialization. As long as the Composable Function has been annotated with @ServerDrivenComponent, the code required for deserialization will be automatically generated.

The auto deserialization is still not complete. We still need to:

Fix to Slow view updates

One reason for slow performance on view updates was the use of Jackson for deserializing the property map. But it was not the only one.

For some reason, view updates were super-complex in Nimbus Compose and it was causing big performance issues. I just replaced it with a simple observer. I'm not sure if my approach was the best, but it works for now. We need to revisit this in the future.

Instead of deleting the code, I just commented it out. It will be easier to revisit this problem if the original code is still there.

Other