Skip to content

Commit

Permalink
Merge pull request #844 from w3c/fix-at-selection-dropdown
Browse files Browse the repository at this point in the history
Fix Data management page crash when Adding Test Plans to the Test Queue and Opening Assistive Technology select to pick any option
  • Loading branch information
stalgiag authored Nov 21, 2023
2 parents c101ecc + c1bf56a commit c29bea9
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 40 deletions.
10 changes: 1 addition & 9 deletions client/components/DataManagement/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ const DataManagement = () => {

const [pageReady, setPageReady] = useState(false);
const [ats, setAts] = useState([]);
const [browsers, setBrowsers] = useState([]);
const [testPlans, setTestPlans] = useState([]);
const [testPlanVersions, setTestPlanVersions] = useState([]);
const [filter, setFilter] = useState(
Expand All @@ -42,14 +41,8 @@ const DataManagement = () => {

useEffect(() => {
if (data) {
const {
ats = [],
browsers = [],
testPlanVersions = [],
testPlans = []
} = data;
const { ats = [], testPlanVersions = [], testPlans = [] } = data;
setAts(ats);
setBrowsers(browsers);
setTestPlans(testPlans);
setTestPlanVersions(testPlanVersions);
setPageReady(true);
Expand Down Expand Up @@ -131,7 +124,6 @@ const DataManagement = () => {

<ManageTestQueue
ats={ats}
browsers={browsers}
testPlanVersions={testPlanVersions}
triggerUpdate={refetch}
/>
Expand Down
8 changes: 4 additions & 4 deletions client/components/DataManagement/queries.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ export const DATA_MANAGEMENT_PAGE_QUERY = gql`
ats {
id
name
browsers {
id
name
}
atVersions {
id
name
Expand All @@ -22,10 +26,6 @@ export const DATA_MANAGEMENT_PAGE_QUERY = gql`
id
}
}
browsers {
id
name
}
testPlans {
id
directory
Expand Down
10 changes: 5 additions & 5 deletions client/components/ManageTestQueue/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ const DisclosureContainer = styled.div`

const ManageTestQueue = ({
ats = [],
browsers = [],
testPlanVersions = [],
triggerUpdate = () => {}
}) => {
Expand Down Expand Up @@ -667,9 +666,11 @@ const ManageTestQueue = ({
item => item.id === selectedTestPlanVersionId
)}
at={ats.find(item => item.id === selectedAtId)}
browser={browsers.find(
item => item.id === selectedBrowserId
)}
browser={ats
.find(at => at.id === selectedAtId)
?.browsers.find(
browser => browser.id === selectedBrowserId
)}
triggerUpdate={triggerUpdate}
disabled={
!selectedTestPlanVersionId ||
Expand Down Expand Up @@ -738,7 +739,6 @@ const ManageTestQueue = ({

ManageTestQueue.propTypes = {
ats: PropTypes.array,
browsers: PropTypes.array,
testPlanVersions: PropTypes.array,
triggerUpdate: PropTypes.func
};
Expand Down
4 changes: 0 additions & 4 deletions client/components/TestQueue/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ const TestQueue = () => {
const [pageReady, setPageReady] = useState(false);
const [testers, setTesters] = useState([]);
const [ats, setAts] = useState([]);
const [browsers, setBrowsers] = useState([]);
const [testPlanVersions, setTestPlanVersions] = useState([]);
const [testPlanReports, setTestPlanReports] = useState([]);
const [latestTestPlanVersions, setLatestTestPlanVersions] = useState([]);
Expand All @@ -45,7 +44,6 @@ const TestQueue = () => {
const {
users = [],
ats = [],
browsers = [],
testPlanVersions = [],
testPlanReports = [],
testPlans = []
Expand All @@ -60,7 +58,6 @@ const TestQueue = () => {
setAts(ats);
setTestPlanVersions(testPlanVersions);
setTestPlanReports(testPlanReports);
setBrowsers(browsers);
setLatestTestPlanVersions(testPlans);
setPageReady(true);
}
Expand Down Expand Up @@ -254,7 +251,6 @@ const TestQueue = () => {
{isAdmin && (
<ManageTestQueue
ats={ats}
browsers={browsers}
testPlanVersions={testPlanVersions}
triggerUpdate={refetch}
/>
Expand Down
4 changes: 0 additions & 4 deletions client/components/TestQueue/queries.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,6 @@ export const TEST_QUEUE_PAGE_QUERY = gql`
name
}
}
browsers {
id
name
}
testPlanVersions {
id
title
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,16 @@ export default (
releasedAt: '2021-11-01T04:00:00.000Z'
}
],
browsers: [
{
id: '2',
name: 'Chrome'
},
{
id: '1',
name: 'Firefox'
}
],
candidateBrowsers: [{ id: '2' }],
recommendedBrowsers: [{ id: '1' }, { id: '2' }]
},
Expand All @@ -52,6 +62,16 @@ export default (
releasedAt: '2021-02-19T05:00:00.000Z'
}
],
browsers: [
{
id: '2',
name: 'Chrome'
},
{
id: '1',
name: 'Firefox'
}
],
candidateBrowsers: [{ id: '2' }],
recommendedBrowsers: [{ id: '1' }, { id: '2' }]
},
Expand All @@ -65,24 +85,24 @@ export default (
releasedAt: '2019-09-01T04:00:00.000Z'
}
],
browsers: [
{
id: '2',
name: 'Chrome'
},
{
id: '1',
name: 'Firefox'
},
{
id: '3',
name: 'Safari'
}
],
candidateBrowsers: [{ id: '3' }],
recommendedBrowsers: [{ id: '2' }, { id: '3' }]
}
],
browsers: [
{
id: '2',
name: 'Chrome'
},
{
id: '1',
name: 'Firefox'
},
{
id: '3',
name: 'Safari'
}
],
testPlans: [
{
id: '27',
Expand Down

0 comments on commit c29bea9

Please sign in to comment.