Skip to content

Commit

Permalink
Hotfix // Remove double encoding of id to load resource correctly in …
Browse files Browse the repository at this point in the history
…search

Signed-off-by: Dinika Saxena <[email protected]>
  • Loading branch information
Dinika committed Feb 6, 2024
1 parent 512b5a9 commit 320521c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
11 changes: 11 additions & 0 deletions cypress/e2e/ResourceContainer.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,17 @@ describe('Resource with id that contains URL encoded characters', () => {
});
});

it('resource with any id opens when user clicks on resource row in Search table', function() {
cy.visit(`/search?layout=Neuron%20Morphology`);

cy.findAllByTestId('search-table-row')
.first()
.click();

cy.findByText('Advanced View').click();
cy.contains(`"@id"`);
});

it('resource opens when user directly navigates to resource page', function() {
const resourcePage = `/${Cypress.env('ORG_LABEL')}/${
this.projectLabel
Expand Down
8 changes: 5 additions & 3 deletions src/subapps/search/containers/SearchContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,15 @@ const SearchContainer: React.FC = () => {
background: location,
});
};
const onRowClick = (record: any): { onClick: () => void } => {
const onRowClick = (
record: any
): { onClick: () => void; 'data-testid': string } => {
return {
onClick: () => {
const [orgLabel, projectLabel] = record.project.label.split('/');
const resourceId = encodeURIComponent(record['@id']);
goToResource(orgLabel, projectLabel, resourceId);
goToResource(orgLabel, projectLabel, record['@id']);
},
'data-testid': 'search-table-row',
};
};
const {
Expand Down

0 comments on commit 320521c

Please sign in to comment.