Skip to content

Commit

Permalink
Add intermediate check to set ready() when initialized signal didn't …
Browse files Browse the repository at this point in the history
…came through (race condition)
  • Loading branch information
jussikinnula committed Jun 9, 2017
1 parent 3017f48 commit c52853a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/translate.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ export default function translate(namespaces, options = {}) {
};

this.i18n.on('initialized', initialized);

// In case of race condition, that 'initialized' never comes - do immediately
// check ready state + if i18n is initialized.
setTimeout(() => !this.state.ready && this.i18n.isInitialized && ready());
}
});

Expand Down

0 comments on commit c52853a

Please sign in to comment.