Skip to content

Commit 6de7b6c

Browse files
authored
fix(annotations): update url for prefix (#2099)
* route back to url prefix instead of '/'
1 parent 7ac0fcd commit 6de7b6c

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/elements/content-sidebar/Sidebar.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ class Sidebar extends React.Component<Props, State> {
135135
handleAnnotationSelect = (annotationId: string | null): void => {
136136
const { history } = this.props;
137137
const urlPrefix = this.getUrlPrefix(history.location.pathname);
138-
const annotationUrl = annotationId ? `/${urlPrefix}/annotations/${annotationId}` : '/';
138+
const annotationUrl = annotationId ? `/${urlPrefix}/annotations/${annotationId}` : `/${urlPrefix}`;
139139

140140
history.push(annotationUrl);
141141
};

src/elements/content-sidebar/__tests__/Sidebar.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ describe('elements/content-sidebar/Sidebar', () => {
148148
expect(historyMock.push).toHaveBeenCalledWith('/activity/annotations/123');
149149
});
150150

151-
test('should handle setting url back to / if no id provided', () => {
151+
test('should handle setting url back to url prefix if no id provided', () => {
152152
const historyMock = {
153153
push: jest.fn(),
154154
location: {
@@ -161,7 +161,7 @@ describe('elements/content-sidebar/Sidebar', () => {
161161

162162
instance.handleAnnotationSelect(null);
163163

164-
expect(historyMock.push).toHaveBeenCalledWith('/');
164+
expect(historyMock.push).toHaveBeenCalledWith('/activity');
165165
});
166166
});
167167

0 commit comments

Comments
 (0)