Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

964 enum circular dep react native #994

Merged

Conversation

leonardpauli
Copy link
Contributor

React native default setup is unable to handle the circular dependency. Delaying the use solves this (7 char change, but changed to legacy function style to match code style).

See #964.

src/enum.js Outdated
@@ -5,7 +5,7 @@ module.exports = Enum;
var ReflectionObject = require("./object");
((Enum.prototype = Object.create(ReflectionObject.prototype)).constructor = Enum).className = "Enum";

var Namespace = require("./namespace"),
var getNamespace = function () { return require("./namespace") },
Copy link
Member

Choose a reason for hiding this comment

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

Isn't there another way, like reordering imports? Asking because there's already a more general workaround in place for similar cases that doesn't require calling a function each time, and instead sets these things up on instantiation.

Copy link
Contributor Author

@leonardpauli leonardpauli Apr 5, 2018

Choose a reason for hiding this comment

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

I see, neat! Updated it :)

Ps. had some fun with node --max_inlined_bytecode_size=0 test.js, not sure if the extra function call would have mattered in execution, though using existing logic is preferred!

@pbaer
Copy link

pbaer commented Apr 6, 2018

Change looks good, hope this can be merged into master soon.

@dcodeIO dcodeIO merged commit f13a81f into protobufjs:master Apr 6, 2018
@dcodeIO
Copy link
Member

dcodeIO commented Apr 6, 2018

Thanks! :)

@dcodeIO
Copy link
Member

dcodeIO commented Apr 6, 2018

Could you check that master, with my additional commit, is working as intended with React Native?

@pbaer
Copy link

pbaer commented May 16, 2018

@dcodeIO the latest version on npmjs is still 6.8.6, when can we expect 6.8.7 with this fix to be published? Thanks.

@dcodeIO
Copy link
Member

dcodeIO commented May 16, 2018

Thanks for the reminder. I had to do some significant changes to dependencies and the build step in the last two commits. Can you verify that master is working for you?

@pbaer
Copy link

pbaer commented May 21, 2018

I can confirm that master is in a good state for us (@SlyryD and I are on the same team).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants