Skip to content

Conversation

@vjeux
Copy link
Contributor

@vjeux vjeux commented Aug 28, 2016

@zpao
Copy link
Member

zpao commented Aug 29, 2016

I don't think we can do this one. Because the keys in the object in SimpleEventPlugin use captured as the key (no quotes), then if gcc crushes those keys then React will stop working.

@gaearon
Copy link
Collaborator

gaearon commented Aug 29, 2016

Good catch, thanks.

function listenerAtPhase(inst, event, propagationPhase) {
function listenerAtPhase(inst, event, propagationPhase: PropagationPhases) {
var registrationName =
event.dispatchConfig.phasedRegistrationNames[propagationPhase];
Copy link
Collaborator

Choose a reason for hiding this comment

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

@vjeux

To be specific, the problem is on this line.
GCC will crush lines like these:

{
  abort: {
    phasedRegistrationNames: {
      bubbled: keyOf({onAbort: true}),
      captured: keyOf({onAbortCapture: true}),
    },
  },
}

into

{
  a: {
    b: {
      c: keyOf({e: true}),
      d: keyOf({f: true}),
    },
  },
}

However, phase will be a full string:

var phase = upwards ? 'bubbled' : 'captured';

and so

 var registrationName =
      event.dispatchConfig.phasedRegistrationNames[propagationPhase];            

will give you undefined.

@vjeux
Copy link
Contributor Author

vjeux commented Aug 29, 2016

After asking on twitter, no one has actually successfully used React with GCC Advanced mode itself in a while and all the ClojureScript libraries just use React as is: https://twitter.com/Vjeux/status/770338982110429186

The plan forward is to kill with fire all the abstractions that we have in place that attempts to try to support GCC Advanced mode in order to make the codebase easier to understand.

If we want to support it or some other similar optimizations going forward, we should start a separate effort for it.

@gaearon
Copy link
Collaborator

gaearon commented Aug 30, 2016

👍

@vjeux vjeux added this to the 15-next milestone Aug 30, 2016
@vjeux vjeux merged commit 738a9e3 into facebook:master Aug 30, 2016
@zpao zpao modified the milestones: 15-next, 15.4.0 Oct 4, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants