Skip to content

Commit

Permalink
feat: improve resurrect spectrum from publication string and avoid cr…
Browse files Browse the repository at this point in the history
…ash (#2879)

* chore: update nmr-processing to version 11.8.0

* refactor: resurrect spectrum from publication string

* chore: update nmr-processing

---------

Co-authored-by: Luc Patiny <luc@patiny.com>
  • Loading branch information
hamed-musallam and lpatiny committed Feb 1, 2024
1 parent c1e1107 commit 004d983
Show file tree
Hide file tree
Showing 8 changed files with 269 additions and 203 deletions.
51 changes: 35 additions & 16 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
"multiplet-analysis": "^2.1.2",
"nmr-correlation": "^2.3.3",
"nmr-load-save": "^0.24.0",
"nmr-processing": "^11.7.0",
"nmr-processing": "^11.8.1",
"nmredata": "^0.9.9",
"numeral": "^2.0.6",
"openchemlib": "^8.7.2",
Expand Down
17 changes: 8 additions & 9 deletions src/component/elements/formik/FormikTextarea.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useFormikContext } from 'formik';
import lodashGet from 'lodash/get';
import { useCallback, useEffect, useMemo, CSSProperties } from 'react';
import { useCallback, useEffect, CSSProperties } from 'react';

interface FormikTextareaProps
extends Omit<React.TextareaHTMLAttributes<HTMLTextAreaElement>, 'style'> {
Expand Down Expand Up @@ -37,9 +37,7 @@ function FormikTextarea(props: FormikTextareaProps) {
}
}, [name, setFieldValue, value]);

const isInvalid = useMemo(() => {
return lodashGet(errors, name);
}, [errors, name]);
const isInvalid = lodashGet(errors, name);

return (
<textarea
Expand All @@ -48,11 +46,12 @@ function FormikTextarea(props: FormikTextareaProps) {
onChange={changeHandler}
style={{
...style,
...(isInvalid && {
borderColor: 'red',
borderWidth: '1px',
outline: 'none',
}),
...(isInvalid
? {
borderColor: 'red',
borderWidth: '1px',
}
: {}),
}}
{...resProps}
/>
Expand Down

0 comments on commit 004d983

Please sign in to comment.