Skip to content

Commit 2494040

Browse files
authored
Merge branch 'main' into dependabot/npm_and_yarn/moped-editor/axios-1.16.0
2 parents f33e0c6 + f1b2318 commit 2494040

7 files changed

Lines changed: 40 additions & 16 deletions

File tree

Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
alter table "public"."ecapris_subproject_funding" alter column "subproject_name" drop not null;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
alter table "public"."ecapris_subproject_funding" alter column "subproject_name" set not null;

moped-editor/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "atd-moped-editor",
33
"author": "TPW Data & Technology Services",
44
"license": "CC0-1.0",
5-
"version": "3.5.1",
5+
"version": "3.6.1",
66
"private": false,
77
"repository": {
88
"type": "git",

moped-editor/src/App.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import { LicenseInfo } from "@mui/x-license";
3030

3131
const HASURA_ENDPOINT = import.meta.env.VITE_HASURA_ENDPOINT;
3232

33-
console.info(`🛵 ${pckg.name} ${pckg.version}`);
33+
console.info(`🛵 ${pckg.name} ${pckg.version} on Vite`);
3434

3535
const useApolloClient = () => {
3636
const [error, setError] = useState(null);

moped-editor/src/views/dev/LookupsView/index.js

Lines changed: 32 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,43 @@ import Can from "src/auth/Can";
2626

2727
/**
2828
* Scroll to a page element based on its key
29+
* @param {string} recordKey - The key representing the record type to scroll to
30+
* @param {Object} refs - An object containing refs for each table element on the page
31+
* @param {string} behavior - The scroll behavior
2932
*/
30-
const scrollToTable = (recordKey, refs) => {
33+
const scrollToTable = (recordKey, refs, behavior = "smooth") => {
3134
const ref = refs?.[recordKey];
35+
3236
if (ref?.current) {
33-
ref.current.scrollIntoView({ behavior: "smooth" });
37+
ref.current.scrollIntoView({ behavior });
3438
}
3539
};
3640

41+
/**
42+
* Custom hook to scroll to a table when the hash in the URL changes. Listens for changes to the hash and
43+
* uses a ResizeObserver to ensure that the element is scrolled into view after any layout shifts.
44+
* @param {Object} props
45+
* @param {string} props.recordKeyHash - The hash from the URL representing the record key to scroll to
46+
* @param {Object} props.refs - An object containing refs for each table element on the page
47+
* */
48+
const useScrollToHash = ({ recordKeyHash, refs }) => {
49+
useEffect(() => {
50+
if (!recordKeyHash) return;
51+
52+
const recordKey = recordKeyHash.replace("#", "").replaceAll("-", "_");
53+
const resizeObserver = new ResizeObserver(() => {
54+
scrollToTable(recordKey, refs, "instant");
55+
});
56+
57+
// Observe resize of every table so we keep scrolling until layout is fully populated with async data
58+
Object.values(refs).forEach((ref) => {
59+
if (ref.current) resizeObserver.observe(ref.current);
60+
});
61+
62+
return () => resizeObserver.disconnect();
63+
}, [recordKeyHash, refs]);
64+
};
65+
3766
const TAG_TABLE_KEYS = ["moped_component_tags", "moped_tags"];
3867

3968
/**
@@ -73,18 +102,8 @@ const LookupsView = () => {
73102
[]
74103
);
75104

76-
/**
77-
* Use the record hash from the URL, if present. This only happens once after
78-
* data fetch.
79-
* */
80105
let { hash: recordKeyHash, pathname } = useLocation();
81-
useEffect(() => {
82-
if (!recordKeyHash || loading) {
83-
return;
84-
}
85-
const recordKey = recordKeyHash.replace("#", "").replaceAll("-", "_");
86-
scrollToTable(recordKey, refs);
87-
}, [recordKeyHash, loading, refs]);
106+
useScrollToHash({ recordKeyHash, refs });
88107

89108
return (
90109
<ApolloErrorHandler error={error}>

moped-editor/src/views/projects/projectView/ProjectSummary/ProjectSummaryProjectECapris.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import TextField from "@mui/material/TextField";
88
import { Box, Grid2, Stack, Typography } from "@mui/material";
99
import { useMutation } from "@apollo/client";
1010
import { useUser } from "src/auth/user";
11+
import { filterOptions } from "src/utils/autocompleteHelpers";
1112

1213
import {
1314
fieldBox,
@@ -130,6 +131,8 @@ const ProjectSummaryProjectECapris = ({
130131
option?.["ecapris_subproject_id"] ===
131132
value?.["ecapris_subproject_id"]
132133
}
134+
// Use custom filterOptions function to limit number of options rendered for performance
135+
filterOptions={filterOptions}
133136
onChange={(_, newValue) => {
134137
setSelectedValue(newValue);
135138
}}

moped-editor/src/views/projects/projectView/ProjectTeam/ProjectTeamTable.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ const useColumns = ({
147147
<Box sx={{ fontWeight: 500 }}>
148148
Role{" "}
149149
<Link
150-
href="data-dictionary#moped-project-roles"
150+
href="/moped/data-dictionary#moped-project-roles"
151151
target="_blank"
152152
rel="noopener noreferrer"
153153
>

0 commit comments

Comments
 (0)