@gradio/tabs 0.2.3 → 0.2.5

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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @gradio/tabs
2
2
 
3
+ ## 0.2.5
4
+
5
+ ### Dependency updates
6
+
7
+ - @gradio/utils@0.3.1
8
+
9
+ ## 0.2.4
10
+
11
+ ### Fixes
12
+
13
+ - [#7470](https://github.com/gradio-app/gradio/pull/7470) [`ba3ec13`](https://github.com/gradio-app/gradio/commit/ba3ec1300e81e64be7389d759b89284c66473158) - Tab select fix. Thanks [@aliabid94](https://github.com/aliabid94)!
14
+
3
15
  ## 0.2.3
4
16
 
5
17
  ### Patch Changes
@@ -109,4 +121,4 @@ Thanks [@pngwn](https://github.com/pngwn)!
109
121
  ### Patch Changes
110
122
 
111
123
  - Updated dependencies []:
112
- - @gradio/utils@0.0.2
124
+ - @gradio/utils@0.0.2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gradio/tabs",
3
- "version": "0.2.3",
3
+ "version": "0.2.5",
4
4
  "description": "Gradio UI packages",
5
5
  "type": "module",
6
6
  "author": "",
@@ -13,6 +13,6 @@
13
13
  "./package.json": "./package.json"
14
14
  },
15
15
  "dependencies": {
16
- "@gradio/utils": "^0.3.0"
16
+ "@gradio/utils": "^0.3.1"
17
17
  }
18
18
  }
@@ -31,11 +31,12 @@
31
31
 
32
32
  setContext(TABS, {
33
33
  register_tab: (tab: Tab) => {
34
+ let index: number;
34
35
  let existingTab = tabs.find((t) => t.id === tab.id);
35
36
  if (existingTab) {
36
37
  // update existing tab with newer values
37
- let i = tabs.findIndex((t) => t.id === tab.id);
38
- tabs[i] = { ...tabs[i], ...tab };
38
+ index = tabs.findIndex((t) => t.id === tab.id);
39
+ tabs[index] = { ...tabs[index], ...tab };
39
40
  } else {
40
41
  tabs.push({
41
42
  name: tab.name,
@@ -44,6 +45,7 @@
44
45
  visible: tab.visible,
45
46
  interactive: tab.interactive
46
47
  });
48
+ index = tabs.length - 1;
47
49
  }
48
50
  selected_tab.update((current) => {
49
51
  if (current === false && tab.visible && tab.interactive) {
@@ -54,7 +56,7 @@
54
56
  return nextTab ? nextTab.id : current;
55
57
  });
56
58
  tabs = tabs;
57
- return tabs.length - 1;
59
+ return index;
58
60
  },
59
61
  unregister_tab: (tab: Tab) => {
60
62
  const i = tabs.findIndex((t) => t.id === tab.id);