@kfiross44/valtio-inspector 0.9.2 → 0.9.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/client/app.js CHANGED
@@ -84,7 +84,9 @@ function storeColor(name) {
84
84
 
85
85
  function renderSidebar() {
86
86
  const list = document.getElementById('store-list')
87
- const stores = Object.keys(stateTree)
87
+ // Sort stores alphabetically
88
+ const stores = Object.keys(stateTree).sort((a, b) => a.localeCompare(b))
89
+
88
90
 
89
91
  if (stores.length === 0) {
90
92
  list.innerHTML = ''
@@ -209,7 +211,11 @@ function buildNode(parent, value, key, path, depth) {
209
211
  if (!collapsed) {
210
212
  const kids = document.createElement('div')
211
213
  kids.className = 'json-children'
212
- for (const [k2, v2] of Object.entries(value)) {
214
+ // Sort the keys alphabetically before mapping to buildNode
215
+ const keys = Object.keys(value).sort((a, b) => a.localeCompare(b))
216
+
217
+ for (const k2 of keys) {
218
+ const v2 = value[k2]
213
219
  buildNode(kids, v2, k2, `${path}.${k2}`, depth + 1)
214
220
  }
215
221
  parent.appendChild(kids)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kfiross44/valtio-inspector",
3
- "version": "0.9.2",
3
+ "version": "0.9.4",
4
4
  "description": "A dev-only Valtio state inspector with WebSocket live updates",
5
5
  "main": "dist/server/index.js",
6
6
  "bin": {