Skip to content

Commit

Permalink
Lint code with ESLint and Prettier
Browse files Browse the repository at this point in the history
Triggered by ae2628d on branch refs/heads/issue-609
  • Loading branch information
acwhite211 authored and github-actions[bot] committed Feb 5, 2025
1 parent ae2628d commit 5a9c1ce
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 25 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

0 comments on commit 5a9c1ce

Please sign in to comment.