Skip to content
This repository has been archived by the owner on May 3, 2022. It is now read-only.

EZP-25626: Add React.js to PlatformUI app and reuse it in Alloy Editor #534

Closed
wants to merge 1 commit into from
Closed

EZP-25626: Add React.js to PlatformUI app and reuse it in Alloy Editor #534

wants to merge 1 commit into from

Conversation

sunpietro
Copy link
Contributor

https://jira.ez.no/browse/EZP-25626

Added React.js directly into main app template file: shell.html.twig.

@sunpietro
Copy link
Contributor Author

ping @dpobel
I found that adding React.js by creating YUI3 module makes AlloyEditor unstable. Sometimes the editor files are loaded before React.js; sometimes they are loaded loaded after it.
@dpobel do you have any suggestions to improve that process?

@sunpietro sunpietro changed the title EZP-25626: Add React.js to PlatformUI app and reuse it in Alloy Editor [WIP] EZP-25626: Add React.js to PlatformUI app and reuse it in Alloy Editor Mar 27, 2016
@sunpietro sunpietro changed the title [WIP] EZP-25626: Add React.js to PlatformUI app and reuse it in Alloy Editor EZP-25626: Add React.js to PlatformUI app and reuse it in Alloy Editor Mar 30, 2016
@sunpietro
Copy link
Contributor Author

It's related to: ezsystems/PlatformUIAssetsBundle#12

@sunpietro
Copy link
Contributor Author

ping @dpobel

@sunpietro
Copy link
Contributor Author

@dpobel I don't know why behat tests are failing.

@@ -9,6 +9,4 @@ YUI.add('ez-alloyeditor', function (Y) {
Y.namespace('eZ');

Y.eZ.AlloyEditor = AlloyEditor;
Y.eZ.React = Y.eZ.AlloyEditor.React;
Copy link
Contributor

Choose a reason for hiding this comment

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

removing those lines is BC break, so we need to keep the definition of Y.eZ.React and Y.eZ.ReactDOM somehow.

Copy link
Contributor

Choose a reason for hiding this comment

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

but we can deprecate and remove in v2 if needed

@dpobel
Copy link
Contributor

dpobel commented Mar 30, 2016

I found that adding React.js by creating YUI3 module makes AlloyEditor unstable. Sometimes the editor files are loaded before React.js; sometimes they are loaded loaded after it.

I guess you added a react module in yui.yml pointing to bundles/ezplatformuiassets/vendors/react/react.js and you added this module as a dependency to alloyeditor or similar approach. And indeed, this might not work because by default the YUI Loader loads the file asynchronously and then for files which content is not wrapped in a YUI.add, the code might not be executed in the expected order (in your case alloy-editor-no-react.js could be evaluated before react.js is fully loaded).

Maybe to avoid that, you could try to adopt a similar strategy as for the REST Client or AlloyEditor itself. Basically, you'll add a react module to yui.yml pointing to bundles/ezplatformuiassets/vendors/react/react.js and then you'll also add a ez-react module which requires react (and defines Y.eZ.React and Y.eZ.ReactDOM see https://github.com/ezsystems/PlatformUIBundle/pull/534/files#r57878901). Then ez-react should be added as a dependency of alloyeditor. Then if a component needs React alone, then it should depend on ez-react.

@sunpietro
Copy link
Contributor Author

ping @dpobel

@sunpietro sunpietro closed this Apr 5, 2018
@sunpietro sunpietro deleted the ezp-25626-add-reactjs-platformui branch April 5, 2018 10:16
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
3 participants