diff --git a/.gitignore b/.gitignore
index 4e3869c..cf99c8d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,3 +2,4 @@ node_modules
*.log
lib
coverage
+.idea
\ No newline at end of file
diff --git a/package.json b/package.json
index b76768d..b0b267e 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "react-gateway",
- "version": "3.0.0",
+ "version": "3.0.1",
"description": "Render React DOM into a new context",
"main": "lib/index.js",
"scripts": {
diff --git a/src/GatewayRegistry.js b/src/GatewayRegistry.js
index 8ef72a9..0372037 100644
--- a/src/GatewayRegistry.js
+++ b/src/GatewayRegistry.js
@@ -7,13 +7,19 @@ export default class GatewayRegistry {
this._currentId = 0;
}
+ _getChildIndex(childId) {
+ return +childId.match(/\d+$/)[0]
+ }
+
_renderContainer(name) {
if (!this._containers[name] || !this._children[name]) {
return;
}
this._containers[name].setState({
- children: Object.keys(this._children[name]).sort().map(id => this._children[name][id])
+ children: Object.keys(this._children[name])
+ .sort((a, b) => this._getChildIndex(a) - this._getChildIndex(b))
+ .map(id => this._children[name][id])
});
}