Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion buildScript/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ export default function makeWebpackConfig(config) {
],
'@babel/preset-react'
],
plugins: [ '@babel/plugin-transform-runtime', 'lodash' ]
plugins: [ 'react-compiler', '@babel/plugin-transform-runtime', 'lodash' ]
}
}
},
Expand Down
16 changes: 16 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,22 @@ export default [
"react/react-in-jsx-scope": 1,
"react/self-closing-comp": 1,
"react-hooks/rules-of-hooks": "error", // Checks rules of Hooks
'react-hooks/exhaustive-deps': 'warn',
'react-hooks/config': 'error',
'react-hooks/error-boundaries': 'error',
'react-hooks/component-hook-factories': 'error',
'react-hooks/gating': 'error',
'react-hooks/globals': 'error',
'react-hooks/immutability': 'error',
'react-hooks/preserve-manual-memoization': 'error',
'react-hooks/purity': 'error',
'react-hooks/refs': 'error',
'react-hooks/set-state-in-effect': 'warn',
'react-hooks/set-state-in-render': 'error',
'react-hooks/static-components': 'error',
'react-hooks/unsupported-syntax': 'warn',
'react-hooks/use-memo': 'error',
'react-hooks/incompatible-library': 'warn',
"jsdoc/check-param-names": 2,
"jsdoc/check-tag-names": 0,
"jsdoc/check-types": 0,
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,13 @@
"babel-jest": "^24.9",
"babel-loader": "^9.1.3",
"babel-plugin-lodash": "^3.3",
"babel-plugin-react-compiler": "^1.0.0",
"css-loader": "~7.1",
"eslint": "~9.38",
"eslint-plugin-jsdoc": "~50.8",
"eslint-plugin-jsx-a11y": "^6.9.0",
"eslint-plugin-react": "~7.37",
"eslint-plugin-react-hooks": "~7.0",
"eslint-plugin-react-hooks": "^7.0.1",
"globals": "~16.4",
"ink-docstrap": "~1.3",
"jest": "^24.9",
Expand Down
25 changes: 12 additions & 13 deletions src/firefly/js/ui/tap/TapViewType.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,18 +92,18 @@ const expandableTapSectionSx = {
};

function AdqlUI({serviceUrl, serviceLabel, servicesShowing, setServicesShowing, setSelectBy, lockService, setError}) {
const [,setCapabilitiesChange] = useState(); // this is just to force a rerender
const capabilities= getLoadedCapability(serviceUrl);
const [capabilities, setCapabilities] = useState(() => getLoadedCapability(serviceUrl));
useEffect(() => {
if (!serviceUrl) return;
setCapabilities(getLoadedCapability(serviceUrl));
if (!isCapabilityLoaded(serviceUrl)) {
loadTapCapabilities(serviceUrl)
.then((c) => setCapabilitiesChange(c??{}))
.catch( (error) => {
setError(`Fail to retrieve capability for: ${serviceUrl}`);
});
.then((c) => setCapabilities(c ?? getLoadedCapability(serviceUrl)))
.catch(() => setError(`Fail to retrieve capability for: ${serviceUrl}`));
Comment on lines +98 to +102
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should it be like this so that it doesn't setState twice when not loaded?

if (isCapabilityLoaded(serviceUrl)) {
    setCapabilities(getLoadedCapability(serviceUrl));
} else {
    loadTapCapabilities(serviceUrl)
         .then((c) => setCapabilities(c ?? getLoadedCapability(serviceUrl)))
         .catch(() => setError(`Fail to retrieve capability for: ${serviceUrl}`));

}
}, [serviceUrl]);


return (
<Sheet variant='outline' sx={{display:'flex', flexDirection: 'column', flexGrow: 1}}>
<Stack spacing={1}>
Expand Down Expand Up @@ -155,7 +155,6 @@ function BasicUI(props) {
const [schemaName, schemaRef, setSchemaName] = useStateRef(lockedSchemaName || searchParams.schema || initState.schemaName || urlApi.schema);
const [tableName, tableRef, setTableName] = useStateRef(lockedTableName || searchParams.table || initState.tableName || urlApi.table);
const [obsCoreEnabled, setObsCoreEnabled] = useState(initState.obsCoreEnabled || initArgs.urlApi?.selectBy === 'obscore');
const [,setCapabilitiesChange] = useState(); // this is just to force a rerender
const [schemaOptions, setSchemaOptions] = useState();
const [tableOptions, setTableOptions] = useState();
const [tableTableModel, setTableTableModel] = useState();
Expand All @@ -165,19 +164,19 @@ function BasicUI(props) {

const schemaIsLocked= !forceLockObsCore && Boolean(lockedSchemaName);
const tableIsLocked= !forceLockObsCore && Boolean(lockedTableName);

const capabilities= getLoadedCapability(serviceUrl);
const [capabilities, setCapabilities] = useState(() => getLoadedCapability(serviceUrl));

useEffect(() => {
if (!serviceUrl) return;
setCapabilities(getLoadedCapability(serviceUrl));
if (!isCapabilityLoaded(serviceUrl)) {
loadTapCapabilities(serviceUrl)
.then((c) => setCapabilitiesChange(c??{}))
.catch( (error) => {
setError(`${SERVICE_EXIST_ERROR}: ${serviceUrl}`);
});
.then((c) => setCapabilities(c ?? getLoadedCapability(serviceUrl)))
.catch(() => setError(`${SERVICE_EXIST_ERROR}: ${serviceUrl}`));
}
}, [serviceUrl]);


const setLockToObsCore= (doLock) => {
if (!hasObsCoreTable || !obsCoreTableModel?.tableData?.data) return;
if (doLock) {
Expand Down
42 changes: 31 additions & 11 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,11 @@
resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.27.1.tgz#a7054dcc145a967dd4dc8fee845a57c1316c9df8"
integrity sha512-D2hP9eA+Sqx1kBZgzxZh0y1trbuU+JoDkiEwqhQ36nodYqJwyEIhPSdMNd7lOm/4io72luTPWH20Yda0xOuUow==

"@babel/helper-validator-identifier@^7.28.5":
version "7.28.5"
resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.28.5.tgz#010b6938fab7cb7df74aa2bbc06aa503b8fe5fb4"
integrity sha512-qSs4ifwzKJSV39ucNjsvc6WVHs6b7S03sOh2OcHF9UHfVPqWWALUsNUVzhSBiItjRZoLHx7nIarVjqKVusUZ1Q==

"@babel/helper-validator-option@^7.27.1":
version "7.27.1"
resolved "https://registry.yarnpkg.com/@babel/helper-validator-option/-/helper-validator-option-7.27.1.tgz#fa52f5b1e7db1ab049445b421c4471303897702f"
Expand Down Expand Up @@ -916,6 +921,14 @@
"@babel/helper-string-parser" "^7.27.1"
"@babel/helper-validator-identifier" "^7.27.1"

"@babel/types@^7.26.0":
version "7.28.6"
resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.28.6.tgz#c3e9377f1b155005bcc4c46020e7e394e13089df"
integrity sha512-0ZrskXVEHSWIqZM/sQZ4EV3jZJXRkio/WCxaqKZP1g//CEWEPSfeZFcms4XeKBCHU0ZKnIkdJeU/kF+eRp5lBg==
dependencies:
"@babel/helper-string-parser" "^7.27.1"
"@babel/helper-validator-identifier" "^7.28.5"

"@cnakazawa/watch@^1.0.3":
version "1.0.4"
resolved "https://registry.yarnpkg.com/@cnakazawa/watch/-/watch-1.0.4.tgz#f864ae85004d0fcab6f50be9141c4da368d1656a"
Expand Down Expand Up @@ -2475,6 +2488,13 @@ babel-plugin-polyfill-regenerator@^0.6.5:
dependencies:
"@babel/helper-define-polyfill-provider" "^0.6.5"

babel-plugin-react-compiler@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/babel-plugin-react-compiler/-/babel-plugin-react-compiler-1.0.0.tgz#bdf7360a23a4d5ebfca090255da3893efd07425f"
integrity sha512-Ixm8tFfoKKIPYdCCKYTsqv+Fd4IJ0DQqMyEimo+pxUOMUR9cVPlwTrFt9Avu+3cb6Zp3mAzl+t1MrG2fxxKsxw==
dependencies:
"@babel/types" "^7.26.0"

babel-preset-jest@^24.9.0:
version "24.9.0"
resolved "https://registry.yarnpkg.com/babel-preset-jest/-/babel-preset-jest-24.9.0.tgz#192b521e2217fb1d1f67cf73f70c336650ad3cdc"
Expand Down Expand Up @@ -3649,16 +3669,16 @@ eslint-plugin-jsx-a11y@^6.9.0:
safe-regex-test "^1.0.3"
string.prototype.includes "^2.0.1"

eslint-plugin-react-hooks@~7.0:
version "7.0.0"
resolved "https://registry.yarnpkg.com/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-7.0.0.tgz#a255a1db826ea42b0e37f160430e4bd0b4b659f9"
integrity sha512-fNXaOwvKwq2+pXiRpXc825Vd63+KM4DLL40Rtlycb8m7fYpp6efrTp1sa6ZbP/Ap58K2bEKFXRmhURE+CJAQWw==
eslint-plugin-react-hooks@^7.0.1:
version "7.0.1"
resolved "https://registry.yarnpkg.com/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-7.0.1.tgz#66e258db58ece50723ef20cc159f8aa908219169"
integrity sha512-O0d0m04evaNzEPoSW+59Mezf8Qt0InfgGIBJnpC0h3NH/WjUAR7BIKUfysC6todmtiZ/A0oUVS8Gce0WhBrHsA==
dependencies:
"@babel/core" "^7.24.4"
"@babel/parser" "^7.24.4"
hermes-parser "^0.25.1"
zod "^3.22.4 || ^4.0.0"
zod-validation-error "^3.0.3 || ^4.0.0"
zod "^3.25.0 || ^4.0.0"
zod-validation-error "^3.5.0 || ^4.0.0"

eslint-plugin-react@~7.37:
version "7.37.5"
Expand Down Expand Up @@ -8761,12 +8781,12 @@ yocto-queue@^1.0.0:
resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-1.2.1.tgz#36d7c4739f775b3cbc28e6136e21aa057adec418"
integrity sha512-AyeEbWOu/TAXdxlV9wmGcR0+yh2j3vYPGOECcIj2S7MkrLyC7ne+oye2BKTItt0ii2PHk4cDy+95+LshzbXnGg==

"zod-validation-error@^3.0.3 || ^4.0.0":
"zod-validation-error@^3.5.0 || ^4.0.0":
version "4.0.2"
resolved "https://registry.yarnpkg.com/zod-validation-error/-/zod-validation-error-4.0.2.tgz#bc605eba49ce0fcd598c127fee1c236be3f22918"
integrity sha512-Q6/nZLe6jxuU80qb/4uJ4t5v2VEZ44lzQjPDhYJNztRQ4wyWc6VF3D3Kb/fAuPetZQnhS3hnajCf9CsWesghLQ==

"zod@^3.22.4 || ^4.0.0":
version "4.1.12"
resolved "https://registry.yarnpkg.com/zod/-/zod-4.1.12.tgz#64f1ea53d00eab91853195653b5af9eee68970f0"
integrity sha512-JInaHOamG8pt5+Ey8kGmdcAcg3OL9reK8ltczgHTAwNhMys/6ThXHityHxVV2p3fkw/c+MAvBHFVYHFZDmjMCQ==
"zod@^3.25.0 || ^4.0.0":
version "4.3.6"
resolved "https://registry.yarnpkg.com/zod/-/zod-4.3.6.tgz#89c56e0aa7d2b05107d894412227087885ab112a"
integrity sha512-rftlrkhHZOcjDwkGlnUtZZkvaPHCsDATp4pGpuOOMDaTdDDXF91wuVDJoWoPsKX/3YPQ5fHuF3STjcYyKr+Qhg==