docusaurus-theme-openapi-docs 1.3.1 → 1.3.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.
@@ -61,7 +61,9 @@ function App({
61
61
 
62
62
  const [code, setCode] = _react.default.useState(children);
63
63
 
64
- action((0, _slice.setStringRawBody)(code));
64
+ (0, _react.useEffect)(() => {
65
+ action((0, _slice.setStringRawBody)(code));
66
+ }, [action, code]);
65
67
  return <div className={_stylesModule.default.playgroundContainer}>
66
68
  <_reactLive.LiveProvider code={children.replace(/\n$/, "")} transformCode={transformCode !== null && transformCode !== void 0 ? transformCode : code => `${code};`} theme={prismTheme} language={language} {...props}>
67
69
  <LiveComponent onEdit={setCode} />
@@ -4,7 +4,7 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  * ========================================================================== */
7
- import React, { useState } from "react";
7
+ import React, { useEffect, useState } from "react";
8
8
  import { usePrismTheme } from "@docusaurus/theme-common";
9
9
  import useIsBrowser from "@docusaurus/useIsBrowser";
10
10
  import { LiveProvider, LiveEditor, withLive } from "react-live";
@@ -40,7 +40,9 @@ const LiveComponent = withLive(Live);
40
40
  function App({ children, transformCode, value, language, action, ...props }) {
41
41
  const prismTheme = usePrismTheme();
42
42
  const [code, setCode] = React.useState(children);
43
- action(setStringRawBody(code));
43
+ useEffect(() => {
44
+ action(setStringRawBody(code));
45
+ }, [action, code]);
44
46
  return (
45
47
  <div className={styles.playgroundContainer}>
46
48
  <LiveProvider
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.3.1",
4
+ "version": "1.3.2",
5
5
  "license": "MIT",
6
6
  "keywords": [
7
7
  "openapi",
@@ -50,7 +50,7 @@
50
50
  "buffer": "^6.0.3",
51
51
  "clsx": "^1.1.1",
52
52
  "crypto-js": "^4.1.1",
53
- "docusaurus-plugin-openapi-docs": "^1.3.1",
53
+ "docusaurus-plugin-openapi-docs": "^1.3.2",
54
54
  "immer": "^9.0.7",
55
55
  "lodash": "^4.17.20",
56
56
  "process": "^0.11.10",
@@ -71,5 +71,5 @@
71
71
  "engines": {
72
72
  "node": ">=14"
73
73
  },
74
- "gitHead": "5f41e8dc4981409902ae96a7d127a2ae7eb9a47d"
74
+ "gitHead": "761a89172da04573369441cf7342f6c643bc3ecd"
75
75
  }
@@ -5,7 +5,7 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  * ========================================================================== */
7
7
 
8
- import React, { useState } from "react";
8
+ import React, { useEffect, useState } from "react";
9
9
 
10
10
  import { usePrismTheme } from "@docusaurus/theme-common";
11
11
  import useIsBrowser from "@docusaurus/useIsBrowser";
@@ -51,7 +51,11 @@ function App({
51
51
  }: any): JSX.Element {
52
52
  const prismTheme = usePrismTheme();
53
53
  const [code, setCode] = React.useState(children);
54
- action(setStringRawBody(code));
54
+
55
+ useEffect(() => {
56
+ action(setStringRawBody(code));
57
+ }, [action, code]);
58
+
55
59
  return (
56
60
  <div className={styles.playgroundContainer}>
57
61
  <LiveProvider