yahoo / react-i13n

A performant, scalable and pluggable approach to instrumenting your React application.
Other
382 stars 42 forks source link

[3.0.0] An breaking change in getInstance() #562

Closed caa1211 closed 1 year ago

caa1211 commented 1 year ago

I found a breaking change in getInstance and lead the react-i13n-reapid or other plugins need to be modified.

react-i13n@3.x getIntance: https://github.com/yahoo/react-i13n/blob/master/src/core/ReactI13n.js#L229

// import
var getInstance = require('react-i13n').getInstance;

// get instance
var instance = getInstance();

react-i13n@2.x getIntance: https://github.com/yahoo/react-i13n/blob/2.x/src/libs/ReactI13n.js#L51

// import
var ReactI13n = require('react-i13n').ReactI13n;

// get instance
var instance = ReactI13n.getInstance();

If we can just let getInstance to be a static method in the ReactI13n class, it will not be a breaking change. I'm not sure if is it a better solution.

pionxzh commented 1 year ago

The document should also be updated If we want to keep the API changes.

redonkulus commented 1 year ago

@caa1211 I'm fine adding it back if it makes less work for the plugins. Do you want to open a PR?

caa1211 commented 1 year ago

ok I can do it

redonkulus commented 1 year ago

Fixed by https://github.com/yahoo/react-i13n/pull/563

redonkulus commented 1 year ago

v3.1.0 has been released with the fix