docusaurus-theme-openapi-docs 1.4.1 → 1.4.2

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.
@@ -147,12 +147,21 @@ function SchemaTabsComponent(props) {
147
147
  const [showTabArrows, setShowTabArrows] = useState(false);
148
148
 
149
149
  useEffect(() => {
150
- const tabOffsetWidth = tabItemListContainerRef.current.offsetWidth;
151
- const tabScrollWidth = tabItemListContainerRef.current.scrollWidth;
150
+ const resizeObserver = new ResizeObserver((entries) => {
151
+ for (let entry of entries) {
152
+ if (entry.target.offsetWidth < entry.target.scrollWidth) {
153
+ setShowTabArrows(true);
154
+ } else {
155
+ setShowTabArrows(false);
156
+ }
157
+ }
158
+ });
152
159
 
153
- if (tabOffsetWidth < tabScrollWidth) {
154
- setShowTabArrows(true);
155
- }
160
+ resizeObserver.observe(tabItemListContainerRef.current);
161
+
162
+ return () => {
163
+ resizeObserver.disconnect();
164
+ };
156
165
  }, []);
157
166
 
158
167
  const handleRightClick = () => {
@@ -147,12 +147,21 @@ function SchemaTabsComponent(props) {
147
147
  const [showTabArrows, setShowTabArrows] = useState(false);
148
148
 
149
149
  useEffect(() => {
150
- const tabOffsetWidth = tabItemListContainerRef.current.offsetWidth;
151
- const tabScrollWidth = tabItemListContainerRef.current.scrollWidth;
150
+ const resizeObserver = new ResizeObserver((entries) => {
151
+ for (let entry of entries) {
152
+ if (entry.target.offsetWidth < entry.target.scrollWidth) {
153
+ setShowTabArrows(true);
154
+ } else {
155
+ setShowTabArrows(false);
156
+ }
157
+ }
158
+ });
152
159
 
153
- if (tabOffsetWidth < tabScrollWidth) {
154
- setShowTabArrows(true);
155
- }
160
+ resizeObserver.observe(tabItemListContainerRef.current);
161
+
162
+ return () => {
163
+ resizeObserver.disconnect();
164
+ };
156
165
  }, []);
157
166
 
158
167
  const handleRightClick = () => {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "docusaurus-theme-openapi-docs",
3
3
  "description": "OpenAPI theme for Docusaurus.",
4
- "version": "1.4.1",
4
+ "version": "1.4.2",
5
5
  "license": "MIT",
6
6
  "keywords": [
7
7
  "openapi",
@@ -51,7 +51,7 @@
51
51
  "buffer": "^6.0.3",
52
52
  "clsx": "^1.1.1",
53
53
  "crypto-js": "^4.1.1",
54
- "docusaurus-plugin-openapi-docs": "^1.4.1",
54
+ "docusaurus-plugin-openapi-docs": "^1.4.2",
55
55
  "file-saver": "^2.0.5",
56
56
  "immer": "^9.0.7",
57
57
  "lodash": "^4.17.20",
@@ -73,5 +73,5 @@
73
73
  "engines": {
74
74
  "node": ">=14"
75
75
  },
76
- "gitHead": "ddfa49093f75f628536b8d9e25f88eb9e541667c"
76
+ "gitHead": "e5337f7fecf3b082c0781f798a479b2a63237432"
77
77
  }
@@ -147,12 +147,21 @@ function SchemaTabsComponent(props) {
147
147
  const [showTabArrows, setShowTabArrows] = useState(false);
148
148
 
149
149
  useEffect(() => {
150
- const tabOffsetWidth = tabItemListContainerRef.current.offsetWidth;
151
- const tabScrollWidth = tabItemListContainerRef.current.scrollWidth;
150
+ const resizeObserver = new ResizeObserver((entries) => {
151
+ for (let entry of entries) {
152
+ if (entry.target.offsetWidth < entry.target.scrollWidth) {
153
+ setShowTabArrows(true);
154
+ } else {
155
+ setShowTabArrows(false);
156
+ }
157
+ }
158
+ });
152
159
 
153
- if (tabOffsetWidth < tabScrollWidth) {
154
- setShowTabArrows(true);
155
- }
160
+ resizeObserver.observe(tabItemListContainerRef.current);
161
+
162
+ return () => {
163
+ resizeObserver.disconnect();
164
+ };
156
165
  }, []);
157
166
 
158
167
  const handleRightClick = () => {