From 4e00602e1d0ab27f4038d57ad19d1338e6a52bab Mon Sep 17 00:00:00 2001 From: melton-jason Date: Wed, 30 Aug 2023 16:07:44 -0500 Subject: [PATCH 1/5] [unload-protext] Don't trigger when setting LatLon plugin values --- .../frontend/js_src/lib/components/FormPlugins/LatLongUi.tsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/specifyweb/frontend/js_src/lib/components/FormPlugins/LatLongUi.tsx b/specifyweb/frontend/js_src/lib/components/FormPlugins/LatLongUi.tsx index ec0e75a7b94..caf86c55bad 100644 --- a/specifyweb/frontend/js_src/lib/components/FormPlugins/LatLongUi.tsx +++ b/specifyweb/frontend/js_src/lib/components/FormPlugins/LatLongUi.tsx @@ -105,8 +105,7 @@ function Coordinate({ * string to float */ resource.set(coordinateField, parsed?.asFloat() ?? null, { silent: true }); - - resource.set(coordinateTextField, trimmedValue); + resource.set(coordinateTextField, trimmedValue, { silent: true }); // Since these fields are no used by sp7, they shouldn't trigger unload protect resource.set( 'srcLatLongUnit', From 77f5c23db1d74e2f1c05b7623a01e71c5cf3856b Mon Sep 17 00:00:00 2001 From: Jason Melton <64045831+melton-jason@users.noreply.github.com> Date: Wed, 17 Jan 2024 16:18:17 +0000 Subject: [PATCH 2/5] Lint code with ESLint and Prettier Triggered by c41b86a6ab238da7d4d61b955bdbabf8b440b2e1 on branch refs/heads/issue-3259-a --- .../js_src/lib/components/DataModel/businessRuleDefs.ts | 4 ++-- .../frontend/js_src/lib/components/DataModel/resource.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/specifyweb/frontend/js_src/lib/components/DataModel/businessRuleDefs.ts b/specifyweb/frontend/js_src/lib/components/DataModel/businessRuleDefs.ts index 391941aaffe..fe1a1452421 100644 --- a/specifyweb/frontend/js_src/lib/components/DataModel/businessRuleDefs.ts +++ b/specifyweb/frontend/js_src/lib/components/DataModel/businessRuleDefs.ts @@ -1,5 +1,5 @@ -import { BusinessRuleResult } from './businessRules'; -import { AnySchema, TableFields } from './helperTypes'; +import type { BusinessRuleResult } from './businessRules'; +import type { AnySchema, TableFields } from './helperTypes'; import { checkPrepAvailability, getTotalLoaned, diff --git a/specifyweb/frontend/js_src/lib/components/DataModel/resource.ts b/specifyweb/frontend/js_src/lib/components/DataModel/resource.ts index 1197d2de2f8..e88ab595406 100644 --- a/specifyweb/frontend/js_src/lib/components/DataModel/resource.ts +++ b/specifyweb/frontend/js_src/lib/components/DataModel/resource.ts @@ -10,6 +10,7 @@ import { userPreferences } from '../Preferences/userPreferences'; import { formatUrl } from '../Router/queryString'; import { relationshipIsToMany } from '../WbPlanView/mappingHelpers'; import { addMissingFields } from './addMissingFields'; +import { getFieldsFromPath } from './businessRules'; import { serializeResource } from './helpers'; import type { AnySchema, @@ -21,7 +22,6 @@ import { getModel, schema } from './schema'; import type { SpecifyModel } from './specifyModel'; import type { Tables } from './types'; import { getUniquenessRules } from './uniquenessRules'; -import { getFieldsFromPath } from './businessRules'; // FEATURE: use this everywhere export const resourceEvents = eventListener<{ From e6b967aca435237b340714f84682de6df4e1b05d Mon Sep 17 00:00:00 2001 From: Jason Melton <64045831+melton-jason@users.noreply.github.com> Date: Wed, 13 Mar 2024 21:17:58 +0000 Subject: [PATCH 3/5] Lint code with ESLint and Prettier Triggered by 188a9bafca8c0b3ed10f955e5226dff576d15c70 on branch refs/heads/issue-3259-a --- specifyweb/frontend/js_src/lib/components/Attachments/utils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specifyweb/frontend/js_src/lib/components/Attachments/utils.ts b/specifyweb/frontend/js_src/lib/components/Attachments/utils.ts index e3cac1f46eb..8226fd00801 100644 --- a/specifyweb/frontend/js_src/lib/components/Attachments/utils.ts +++ b/specifyweb/frontend/js_src/lib/components/Attachments/utils.ts @@ -1,7 +1,7 @@ import { f } from '../../utils/functools'; import { filterArray } from '../../utils/types'; import type { Relationship } from '../DataModel/specifyField'; -import { SpecifyTable } from '../DataModel/specifyTable'; +import type { SpecifyTable } from '../DataModel/specifyTable'; import { genericTables, getTable } from '../DataModel/tables'; import { hasTablePermission } from '../Permissions/helpers'; From d0788a9fe96135040234e773fe40a7f186b7c0dd Mon Sep 17 00:00:00 2001 From: melton-jason Date: Wed, 13 Mar 2024 16:20:10 -0500 Subject: [PATCH 4/5] LatLongUIPlugin do not make setting coordinateField silent --- .../frontend/js_src/lib/components/FormPlugins/LatLongUi.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specifyweb/frontend/js_src/lib/components/FormPlugins/LatLongUi.tsx b/specifyweb/frontend/js_src/lib/components/FormPlugins/LatLongUi.tsx index 33542a2a77a..7bee5de38b8 100644 --- a/specifyweb/frontend/js_src/lib/components/FormPlugins/LatLongUi.tsx +++ b/specifyweb/frontend/js_src/lib/components/FormPlugins/LatLongUi.tsx @@ -102,7 +102,7 @@ function Coordinate({ * may experience a change of precision during the conversion from * string to float */ - resource.set(coordinateField, parsed?.asFloat() ?? null, { silent: true }); + resource.set(coordinateField, parsed?.asFloat() ?? null); resource.set(coordinateTextField, trimmedValue, { silent: true }); // Since these fields are no used by sp7, they shouldn't trigger unload protect resource.set( From 2b867e9d9fe34475303e783eb124488c59a35c96 Mon Sep 17 00:00:00 2001 From: melton-jason Date: Mon, 27 May 2024 09:21:12 -0500 Subject: [PATCH 5/5] Only set unloadprotect when changing coordinateTextFields --- .../frontend/js_src/lib/components/FormPlugins/LatLongUi.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/specifyweb/frontend/js_src/lib/components/FormPlugins/LatLongUi.tsx b/specifyweb/frontend/js_src/lib/components/FormPlugins/LatLongUi.tsx index 7bee5de38b8..f70856e72ae 100644 --- a/specifyweb/frontend/js_src/lib/components/FormPlugins/LatLongUi.tsx +++ b/specifyweb/frontend/js_src/lib/components/FormPlugins/LatLongUi.tsx @@ -102,8 +102,8 @@ function Coordinate({ * may experience a change of precision during the conversion from * string to float */ - resource.set(coordinateField, parsed?.asFloat() ?? null); - resource.set(coordinateTextField, trimmedValue, { silent: true }); + resource.set(coordinateField, parsed?.asFloat() ?? null, { silent: true }); + resource.set(coordinateTextField, trimmedValue); // Since these fields are no used by sp7, they shouldn't trigger unload protect resource.set( 'srcLatLongUnit',