From 9019c38e8b3370a5e773c324c333cb8fa5a4e219 Mon Sep 17 00:00:00 2001 From: Jan Starzak Date: Fri, 14 Jun 2024 09:16:32 +0200 Subject: [PATCH] fix: unpersisted event is handed off into a promise resolution callback --- src/ContextMenuTrigger.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/ContextMenuTrigger.js b/src/ContextMenuTrigger.js index a193a56e..9d7058b7 100644 --- a/src/ContextMenuTrigger.js +++ b/src/ContextMenuTrigger.js @@ -126,7 +126,9 @@ export default class ContextMenuTrigger extends Component { id: this.props.id }; if (data && (typeof data.then === 'function')) { - // it's promise + // it's promise, the event needs to be persisted, so that React + // doesn't reuse the event object while the data function resolves + event.persist(); data.then((resp) => { showMenuConfig.data = assign({}, resp, { target: event.target