Skip to content

Commit

Permalink
Lint code with ESLint and Prettier
Browse files Browse the repository at this point in the history
Triggered by 13d3532 on branch refs/heads/issue-5131
  • Loading branch information
grantfitzsimmons authored and github-actions[bot] committed Feb 4, 2025
1 parent 13d3532 commit 667380e
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,10 @@ const isDarkMode = ({
}: PreferencesVisibilityContext): boolean => isDarkMode || isRedirecting;

// Navigator may not be defined in some environments, like non-browser environments
const altKeyName = typeof navigator !== 'undefined' && navigator?.userAgent?.includes('Mac')
? 'Option'
: 'Alt';
const altKeyName =
typeof navigator !== 'undefined' && navigator?.userAgent?.includes('Mac')
? 'Option'
: 'Alt';

/**
* Have to be careful as preferences may be used before schema is loaded
Expand Down
47 changes: 25 additions & 22 deletions specifyweb/frontend/js_src/lib/components/QueryComboBox/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -264,29 +264,32 @@ export function QueryComboBox({
(typeof typeSearch === 'object' ? typeSearch?.table : undefined) ??
field.relatedTable;

const [fetchedTreeDefinition] = useAsyncState(
React.useCallback(async () => {
if (resource?.specifyTable === tables.Determination) {
return resource.collection?.related?.specifyTable === tables.CollectionObject
? (resource.collection?.related as SpecifyResource<CollectionObject>)
.rgetPromise('collectionObjectType')
.then(
(
collectionObjectType:
| SpecifyResource<CollectionObjectType>
| undefined
) => collectionObjectType?.get('taxonTreeDef')
)
: undefined;
} else if (resource?.specifyTable === tables.Taxon) {
const definition = resource.get('definition')
const parentDefinition = (resource?.independentResources?.parent as SpecifyResource<AnySchema>)?.get?.('definition');
return definition || parentDefinition;
const [fetchedTreeDefinition] = useAsyncState(
React.useCallback(async () => {
if (resource?.specifyTable === tables.Determination) {
return resource.collection?.related?.specifyTable ===
tables.CollectionObject
? (resource.collection?.related as SpecifyResource<CollectionObject>)
.rgetPromise('collectionObjectType')
.then(
(
collectionObjectType:
| SpecifyResource<CollectionObjectType>
| undefined
) => collectionObjectType?.get('taxonTreeDef')
)
: undefined;
} else if (resource?.specifyTable === tables.Taxon) {
const definition = resource.get('definition');
const parentDefinition = (
resource?.independentResources?.parent as SpecifyResource<AnySchema>
)?.get?.('definition');
return definition || parentDefinition;
}
return undefined;
}, [resource, resource?.collection?.related?.get('collectionObjectType')]),
false
);
return undefined;
}, [resource, resource?.collection?.related?.get('collectionObjectType')]),
false
);

// Tree Definition passed by a parent QCBX in the component tree
const parentTreeDefinition = React.useContext(TreeDefinitionContext);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ export function SwitchCollectionCommand(): null {
body: collectionId!.toString(),
errorMode: 'dismissible',
})
.then(clearAllCache)
.then(() => globalThis.location.replace(nextUrl)),
.then(clearAllCache)
.then(() => globalThis.location.replace(nextUrl)),
[collectionId, nextUrl]
),
true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ function testFilter<SCHEMA extends AnySchema>(
? // Cast numbers to strings
values.some((value) => {
const fieldValue = resource.get(field);
// eslint-disable-next-line eqeqeq

return isRelationship
? value == strictIdFromUrl(fieldValue!).toString()
: value == fieldValue;
Expand Down

0 comments on commit 667380e

Please sign in to comment.