Skip to content

[RFC] web_react: React.js Widget #562

@lasley

Description

@lasley

The intent of this module will be to provide a basic React implementation in Odoo.

I'm currently back and forth on whether one of the intents will also be to integrate with our existing Backbone.js model & router framework. I have played around with this a bit by hand now and have it working well, we won't be able to use some of the great performance tuning features like shouldComponentUpdate due to Backbone's mutative nature.

I did find a decent middle ground in react.backbone, but I still see the lacking performance features here too. It's definitely better than my by hand implementation, but it's still a pretty naive implementation IMO.

I'm wondering if integrating the Backbone framework would cause more harm than good though? The only application I know of that actually uses Backbone is pos, which I see no reason for using React in. We could instead use something like Redux, which I feel is more fluid when architecting for React.

In my head, I envision the React Component to be the same concept as the Odoo Widget. The actual React Component would be stored in a component attribute of the new widget, which would render and have lifecycle managed via overrides of the standard widget lifecycle management methods (renderElement, replaceElement, etc). We could even use our standard QWeb template handling via the pre-existing template attribute of the widget.

I'm sure I'm missing some of the high level here, but this is the plan for the most part. Basically just hook up React & provide a ReactWidget API for developers to use, which circumvents a lot of boilerplate. Any thoughts, or advice of pre-existing code to base from?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions