Skip to content

Commit 7a1e1b5

Browse files
fix(region): Update the active annotation id when in create mode (#507)
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
1 parent 8842014 commit 7a1e1b5

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

src/region/RegionAnnotations.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ export default class RegionAnnotations extends React.PureComponent<Props, State>
8989
<>
9090
{/* Layer 1: Saved annotations */}
9191
<RegionList
92-
activeId={isCreating ? null : activeAnnotationId}
92+
activeId={activeAnnotationId}
9393
annotations={annotations}
9494
className="ba-RegionAnnotations-list"
9595
onSelect={this.handleAnnotationActive}

src/region/__tests__/RegionAnnotations-test.tsx

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -203,13 +203,10 @@ describe('components/region/RegionAnnotations', () => {
203203
expect(wrapper.find(PopupReply).prop('isPending')).toBe(isPending);
204204
});
205205

206-
test.each([true, false])('should pass activeId to list only if isCreating is %s', isCreating => {
207-
const wrapper = getWrapper({
208-
activeAnnotationId: '123',
209-
isCreating,
210-
});
206+
test('should pass activeId to the region list', () => {
207+
const wrapper = getWrapper({ activeAnnotationId: '123' });
211208

212-
expect(wrapper.find(RegionList).prop('activeId')).toBe(isCreating ? null : '123');
209+
expect(wrapper.find(RegionList).prop('activeId')).toBe('123');
213210
});
214211

215212
test('should not render creation components if not in creation mode', () => {

0 commit comments

Comments
 (0)