28 comments

[ 264 ms ] story [ 1486 ms ] thread
why is this top of HN?
What is the point of making a private reference to (what I assume) is a public ReactDOM reference?
Do not ask these questions you will be fired.
Do not make fun of that statement or you will be fired.
It's a shunt so that people working with the current version of React don't have to know that ReactDOM exists until the refactor is complete.

It's a good, simple refactoring strategy when you're trying to responsibly change an API.

Anyone able to offer an explanation of what this means?
(comment deleted)
Funny variable name for being part of Facebook's official React repo.
Question to HN: I'm trying to find the commit that originally added this line. How do you do this elegantly?

Git blame:

https://github.com/facebook/react/blame/80bff5397bf854750dbe...

The last commit for this line:

https://github.com/facebook/react/commit/d17091ddebf317173eb...

It says:

src/React.js → src/umd/ReactUMDEntry.js

and essentially, the line was moved two spots down. Now I want to see the git blame before this change. Here is where it gets messy...

Best I can think of is go to the parent commit:

https://github.com/facebook/react/commit/d8ee071c92994879fa8...

Then look for the original file, src/React.js. So I go to "browse files at this revision", browse to the src/ dir, click React.js, then blame again:

https://github.com/facebook/react/blame/d8ee071c92994879fa82...

Alright, we're there.

Is there an easier way? This feels very convoluted and hacky...

git bisect with a grep?
Just did this to make sure. My steps for the interested:

Start with a file named `check` with the contents:

    grep "__SECRET_DOM_DO_NOT_USE_OR_YOU_WILL_BE_FIRED" src/React.js && exit 1
    exit 0
The commit is good if the line isn't there, the commit is bad if the line is there.

Then find the first commit in the entire repository (it's 75897c2dcd1dd3a6ca46284dd37e13d22b4b16b4):

    git rev-list --max-parents=0 HEAD
Then run:

    git bisect start HEAD 75897c2dcd1dd3a6ca46284dd37e13d22b4b16b4
    git bisect run ./check
And a few seconds later git will tell us that it was commit https://github.com/facebook/react/commit/b2ca3349c27b57b1e94...:

    b2ca3349c27b57b1e9462944cbe4aaaf76783d2b] Actually build react-dom file with the build
    running ./check
    React.__SECRET_DOM_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = ReactDOM;
    b2ca3349c27b57b1e9462944cbe4aaaf76783d2b is the first bad commit
    commit b2ca3349c27b57b1e9462944cbe4aaaf76783d2b
    Author: Paul O’Shannessy <paul@oshannessy.com>
    Date:   Tue Sep 8 10:13:24 2015 -0700

        Actually build react-dom file with the build

    :100644 100644 8b66781299e8980740f8f9a13ad31a0cb30fd684 c20a6aa20e3d3d26c63cf3ac7ee087c93dd8a7d6 M	.eslintignore
    :100644 100644 e99175b6a10b11857f4c6242341731af6138c3ca 3f4a02e3e372af1b04b5bb2f1ee2b4384ef22295 M	Gruntfile.js
    :040000 040000 7e99fe9ef7324209890325e2fd9a4a430a706814 1aeab86f880dbf4366709930d7134921bee9401e M	grunt
    :040000 040000 357233750d2d661818a5ba70ab21fe8049ab9583 154a4f6f867aa8eddc8637aadae8bd3c38e794eb M	src
    :040000 040000 4216cc98bca3b6d6276bdfbbb29a1ca14bed1972 1e90bf75ef899c6a0ed0484c5138f4d62f32b8d4 M	vendor
    bisect run success

`git log -S` might be better for this specific case, but `git bisect` is far more powerful so it's very useful to know how it works.
I don't think there's a better way, I do GitHub archaeology like this all the time.
I had the same question, and without actually cloning the repo I wish I had a better answer.

I found, looking through the tags, that src/React.js was added in 0.14-stable, then I examined the history of React.js to find this commit:

https://github.com/facebook/react/commit/b2ca3349c27b57b1e94...

Additionally, I dug this up:

https://github.com/facebook/react/pull/4814#discussion-diff-...

https://github.com/facebook/react/pull/4814

"I changed it to __SECRET_DOM_DO_NOT_USE_OR_YOU_WILL_BE_FIRED to make our German friends less grossed out. I'm going to do the examples in a separate PR."

What was the thing that might have grossed out German friends? I'm German and I can't see any funny word here
I edited it in; my apologies. SECRET was SEKRET, which apparently means "secretion" in German.

Ultimately this doesn't answer the question of why is it named this way.

Use pickaxe

$ git log -S__SECRET_DOM_DO_NOT_USE_OR_YOU_WILL_BE_FIRED

commit d17091ddebf317173eb30e3ab4a8e28e124c8f50

Author: Paul O’Shannessy <paul@oshannessy.com>

Date: Thu Mar 24 11:00:38 2016 -0700

    Make Browserify-specific modules to remove DOM dependencies from npm package

commit 712199ef9830359c35c1c2442d79676396c06a2d

Author: Jim <jsfb@github>

Date: Mon Oct 5 15:02:34 2015 -0700

    React -> ReactDOM for render() and findDOMNode()

commit b2ca3349c27b57b1e9462944cbe4aaaf76783d2b

Author: Paul O’Shannessy <paul@oshannessy.com>

Date: Tue Sep 8 10:13:24 2015 -0700

    Actually build react-dom file with the build
Perfect solution!

$ git log -p -S "SECRET_DOM_DO_NOT_USE_OR_YOU_WILL_BE_FIRED"

(comment deleted)
(comment deleted)
Off topic, but this is the second submission I've seen where the title was all in caps except "Not" and having just done a test it seems that HN converts "NOT" to "Not". I'm curious as to why...

Other submission was this one: https://news.ycombinator.com/item?id=11411368

I think a lot of people like to post NOT in capitals, so they had to implement this.

Things NOT to do if you are a developer. How NOT to apply for a job.

No doubt one of pg's low-tech tricks from way back.