Skip to content

Commit

Permalink
PROCESS: Reduced production chunks (see #248).
Browse files Browse the repository at this point in the history
  • Loading branch information
benel committed Jan 14, 2025
1 parent 89c2d68 commit 58bab03
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
4 changes: 3 additions & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"lint": "eslint .",
"test": "cypress run",
"test2": "cypress open",
"weigh": "vite-bundle-visualizer",
"build": "vite build"
},
"cypress-cucumber-preprocessor": {
Expand All @@ -45,6 +46,7 @@
"eslint-plugin-react-hooks": "^5.1.0-rc.0",
"eslint-plugin-react-refresh": "^0.4.9",
"globals": "^15.9.0",
"vite": "^5.4.1"
"vite": "^5.4.1",
"vite-bundle-visualizer": "^1.2.1"
}
}
12 changes: 6 additions & 6 deletions frontend/src/App.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import { useState, useEffect, StrictMode } from 'react';
import './styles/index.css';
import Menu from './components/Menu';
import Lectern from './routes/Lectern';
Expand All @@ -16,9 +16,9 @@ const backend = new Hyperglosae(
);

function App() {
const [types, setTypes] = React.useState([]);
const [user, setUser] = React.useState();
React.useEffect(() => {
const [types, setTypes] = useState([]);
const [user, setUser] = useState();
useEffect(() => {
backend.getView({view: 'types', options: ['include_docs']})
.then(
(rows) => {
Expand All @@ -27,7 +27,7 @@ function App() {
);
}, []);
return (
<React.StrictMode>
<StrictMode>
<BrowserRouter>
<Menu {...{backend, user, setUser}} />
<NotificationContainer />
Expand All @@ -39,7 +39,7 @@ function App() {
</Routes>
</TypesContext.Provider>
</BrowserRouter>
</React.StrictMode>
</StrictMode>
);
}

Expand Down
6 changes: 3 additions & 3 deletions frontend/src/components/Metadata.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import '../styles/Metadata.css';

import { useEffect, useState } from 'react';
import yaml from 'yaml';
import { parse, stringify } from 'yaml';

function Metadata({metadata = {}, editable, backend, setLastUpdate}) {
const [beingEdited, setBeingEdited] = useState(false);
Expand All @@ -25,7 +25,7 @@ function Metadata({metadata = {}, editable, backend, setLastUpdate}) {
...Object.fromEntries(
Object.entries(editedDocument).filter(([key, _]) => !key.startsWith('dc_'))
),
...yaml.parse(event.target.value)
...parse(event.target.value)
};
setEditedDocument(updatedDocument);
backend.putDocument(updatedDocument)
Expand Down Expand Up @@ -64,7 +64,7 @@ function Metadata({metadata = {}, editable, backend, setLastUpdate}) {
return (
<form>
<textarea className="form-control" type="text" rows="5" autoFocus
defaultValue={yaml.stringify(editedMetadata)} onBlur={handleBlur}
defaultValue={stringify(editedMetadata)} onBlur={handleBlur}
/>
</form>
);
Expand Down

0 comments on commit 58bab03

Please sign in to comment.