Skip to content

Commit

Permalink
Working for not logged in users again
Browse files Browse the repository at this point in the history
  • Loading branch information
gnarf committed Jun 21, 2024
1 parent 89100a7 commit df31163
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
19 changes: 14 additions & 5 deletions client/components/TestRun/CollectionJobContext.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,19 @@ export const Context = createContext({
actions: {}
});

export const Provider = ({
children,
testPlanRun: { id: testPlanRunId, collectionJob: initialCollectionJob }
}) => {
export const Provider = ({ children, testPlanRun }) => {
if (!testPlanRun) {
// Anonymous page / not working, just viewing the tests, no need for the
// provider to provide any data or updates, but to be consistent we will
// still wrap with a provider with static data
return (
<Context.Provider value={{ state: {}, actions: {} }}>
{children}
</Context.Provider>
);
}
const { id: testPlanRunId, collectionJob: initialCollectionJob } =
testPlanRun;
const [providerValue, setProviderValue] = useState({
state: { collectionJob: initialCollectionJob },
actions: {}
Expand Down Expand Up @@ -60,5 +69,5 @@ Provider.propTypes = {
status: PropTypes.string.isRequired,
testStatus: PropTypes.arrayOf(PropTypes.object).isRequired
})
}).isRequired
})
};
2 changes: 1 addition & 1 deletion client/components/TestRun/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -955,7 +955,7 @@ const TestRun = () => {
];
}

const externalLogsUrl = testPlanRun.collectionJob?.externalLogsUrl;
const externalLogsUrl = testPlanRun?.collectionJob?.externalLogsUrl;

const menuRightOfContent = (
<div role="complementary">
Expand Down

0 comments on commit df31163

Please sign in to comment.