Skip to content

Commit

Permalink
Monkeypatching datahero react. datahero-node#15596 facebook/react/fac…
Browse files Browse the repository at this point in the history
  • Loading branch information
Dan Lopuch committed Sep 21, 2015
1 parent 668d6a3 commit 003173d
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 3 deletions.
35 changes: 35 additions & 0 deletions __HEY_DATAHERO_README_B4_UPGRADING.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@

DATAHERO REACT, v0.13.3 MONKEYPATCH


README BEFORE UPGRADING COPY OF REACT!



We use a monkeypatched version of React.

Long story short, Zendesk widget uses its own packaging of React, and React currently has a bug where multiple
instances of React don't play nicely with each other.

See:
https://github.com/Datahero/datahero-node/issues/15596
https://github.com/facebook/react/issues/1939


----------
WHAT THIS MEANS FOR UPGRADING:

1) We had to make a change to our version of React -- we changed the ID_ATTRIBUTE_NAME string to a custom 'data-dh-reactid' to
isolate our React from the Zendesk React.

2) There's a weird Backbone router hack. In main.js, there's a sendToRouter() function that's a global click handler which sends
all <a> clicks to the backbone handler. It skips clicks from react elements, as guarded by with a 'data-reactid' check. This
has been customized to always abort on 'data-dh-reactid' checks. This weird hack needs to be adjusted if adding a different
react namespace.

If upgrading a version React and react#1939 has not yet been resolved, apply the same monkeypatch to the new copy of react.



This file can be deleted once a solution is put in place.

4 changes: 2 additions & 2 deletions docs/js/react.js
Original file line number Diff line number Diff line change
Expand Up @@ -1786,7 +1786,7 @@ var defaultValueCache = {};
*/
var DOMProperty = {

ID_ATTRIBUTE_NAME: 'data-reactid',
ID_ATTRIBUTE_NAME: 'data-dh-reactid',

/**
* Checks whether a property name is a standard property.
Expand Down Expand Up @@ -19559,4 +19559,4 @@ if ("production" !== "development") {
module.exports = warning;

},{"114":114}]},{},[1])(1)
});
});
2 changes: 1 addition & 1 deletion src/browser/ui/dom/DOMProperty.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ var defaultValueCache = {};
*/
var DOMProperty = {

ID_ATTRIBUTE_NAME: 'data-reactid',
ID_ATTRIBUTE_NAME: 'data-dh-reactid',

/**
* Checks whether a property name is a standard property.
Expand Down

0 comments on commit 003173d

Please sign in to comment.