Skip to content

Commit 70f4530

Browse files
fix: skip data-change event for SET_2D_LEVEL action
Avoid triggering unnecessary data-change events when the 2D level changes. This should be handled internally in NMRium.
1 parent 6ea0043 commit 70f4530

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/NMRiumWrapper.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ export default function NMRiumWrapper() {
2626
const { load: loadSpectra, data, isLoading } = useLoadSpectra();
2727

2828
const dataChangeHandler = useCallback<NMRiumChangeCb>((state, source) => {
29+
// avoid triggering data-change event for SET_2D_LEVEL action, This should be handled internally in NMRium
30+
if (source === 'view' && state.data.actionType === 'SET_2D_LEVEL') {
31+
return;
32+
}
2933
events.trigger('data-change', { state, source });
3034
}, []);
3135

0 commit comments

Comments
 (0)