Skip to content

Commit f805107

Browse files
author
Conrad Chan
authored
fix(popuplayer): Only render PopupReply for staged location (#607)
1 parent fc83a1d commit f805107

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/popup/PopupLayer.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ const PopupLayer = (props: Props): JSX.Element | null => {
8989

9090
return (
9191
<>
92-
{canCreate && canReply && reference && (
92+
{canCreate && canReply && reference && staged && (
9393
<div className="ba-PopupLayer-popup">
9494
<PopupReply
9595
isPending={isPending}

src/popup/__tests__/PopupLayer-test.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,15 @@ describe('PopupLayer', () => {
8484
expect(wrapper.exists(PopupReply)).toBe(false);
8585
});
8686

87-
test('should render PopupReply if promoting a highlight', () => {
87+
test('should render PopupReply if promoting a highlight and staged exists', () => {
8888
const wrapper = getWrapper({ mode: Mode.NONE, isPromoting: true });
8989
expect(wrapper.exists(PopupReply)).toBe(true);
9090
});
91+
92+
test('should not render PopupReply if promoting a highlight but staged does not exist', () => {
93+
const wrapper = getWrapper({ mode: Mode.NONE, isPromoting: true, staged: null });
94+
expect(wrapper.exists(PopupReply)).toBe(false);
95+
});
9196
});
9297

9398
describe('event handlers', () => {

0 commit comments

Comments
 (0)