Skip to content

964 enum circular dep react native#994

Merged
dcodeIO merged 3 commits intoprotobufjs:masterfrom
leonardpauli:964-enum-circular-dep-react-native
Apr 6, 2018
Merged

964 enum circular dep react native#994
dcodeIO merged 3 commits intoprotobufjs:masterfrom
leonardpauli:964-enum-circular-dep-react-native

Conversation

@leonardpauli
Copy link
Copy Markdown
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.

Comment thread src/enum.js Outdated
((Enum.prototype = Object.create(ReflectionObject.prototype)).constructor = Enum).className = "Enum";

var Namespace = require("./namespace"),
var getNamespace = function () { return require("./namespace") },
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown

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
Copy Markdown
Member

dcodeIO commented Apr 6, 2018

Thanks! :)

@dcodeIO
Copy link
Copy Markdown
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
Copy Markdown

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
Copy Markdown
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
Copy Markdown

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.

3 participants