({active, getSQLValue})
| 15 | |
| 16 | // Optional SQL tab. |
| 17 | export function SQLTab({active, getSQLValue}) { |
| 18 | const [sql, setSql] = useState('Loading...'); |
| 19 | useEffect(() => { |
| 20 | let unmounted = false; |
| 21 | if(active) { |
| 22 | setSql('Loading...'); |
| 23 | getSQLValue().then((value) => { |
| 24 | if(!unmounted) { |
| 25 | setSql(value); |
| 26 | } |
| 27 | }); |
| 28 | } |
| 29 | return () => {unmounted=true;}; |
| 30 | }, [active]); |
| 31 | |
| 32 | return <InputSQL |
| 33 | value={sql} |
| 34 | options={{ |
| 35 | readOnly: true, |
| 36 | }} |
| 37 | readonly={true} |
| 38 | className='FormView-sqlTabInput' |
| 39 | />; |
| 40 | } |
| 41 | |
| 42 | SQLTab.propTypes = { |
| 43 | active: PropTypes.bool, |
nothing calls this directly
no test coverage detected