Skip to content

Commit

Permalink
Merge pull request #288 from open-rpc/fix/def-petstore
Browse files Browse the repository at this point in the history
fix: default to petstore
  • Loading branch information
shanejonas authored Sep 25, 2019
2 parents 22c5dfd + f66b5ea commit 1aceb66
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import useMonacoReplaceMetaSchema from "./hooks/useMonacoReplaceMetaSchema";
import InspectorPlugin from "./plugins/InspectorPlugin";
import UISchemaStore from "./stores/UISchemaStore";
import searchBarStore from "./stores/searchBarStore";
import examples from "./examplesList";

const App: React.FC = () => {
const [defaultValue, setDefaultValue] = useDefaultEditorValue();
Expand All @@ -31,6 +32,13 @@ const App: React.FC = () => {
const [UISchema, setUISchemaBySection]: [IUISchema, any] = UISchemaStore();
const [monacoTheme, setMonacoTheme] = useState();

useEffect(() => {
const defaultExample = examples.find((e) => e.name === "petstore");
if (!defaultValue && !searchUrl && defaultExample) {
setSearchUrl(defaultExample.url);
}
}, [defaultValue]);

useEffect(() => {
if (editor) {
monaco.editor.setTheme(UISchema.appBar["ui:darkMode"] ? "vs-dark" : "vs");
Expand Down

0 comments on commit 1aceb66

Please sign in to comment.