From 003173de0ed3bad68f572571ee23edc4bed4cb72 Mon Sep 17 00:00:00 2001 From: Dan Lopuch Date: Mon, 21 Sep 2015 11:20:06 -0700 Subject: [PATCH] Monkeypatching datahero react. datahero-node#15596 facebook/react/#1939 --- __HEY_DATAHERO_README_B4_UPGRADING.txt | 35 ++++++++++++++++++++++++++ docs/js/react.js | 4 +-- src/browser/ui/dom/DOMProperty.js | 2 +- 3 files changed, 38 insertions(+), 3 deletions(-) create mode 100644 __HEY_DATAHERO_README_B4_UPGRADING.txt diff --git a/__HEY_DATAHERO_README_B4_UPGRADING.txt b/__HEY_DATAHERO_README_B4_UPGRADING.txt new file mode 100644 index 0000000000000..d4344740ef8fd --- /dev/null +++ b/__HEY_DATAHERO_README_B4_UPGRADING.txt @@ -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 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. + diff --git a/docs/js/react.js b/docs/js/react.js index 4233aec5f23e7..56bdc8e3191db 100644 --- a/docs/js/react.js +++ b/docs/js/react.js @@ -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. @@ -19559,4 +19559,4 @@ if ("production" !== "development") { module.exports = warning; },{"114":114}]},{},[1])(1) -}); \ No newline at end of file +}); diff --git a/src/browser/ui/dom/DOMProperty.js b/src/browser/ui/dom/DOMProperty.js index d6cc399e8a632..ae6facaac50cd 100644 --- a/src/browser/ui/dom/DOMProperty.js +++ b/src/browser/ui/dom/DOMProperty.js @@ -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.