cheminfo / nmrium

React component to display and process nuclear magnetic resonance (NMR) spectra.
https://docs.nmrium.org
MIT License
55 stars 25 forks source link

unhandled error in ZonesActions #2466

Closed targos closed 1 year ago

targos commented 1 year ago
Cannot read properties of undefined (reading 'maxX') / l is undefined

{
  source: 'webpack://_N_E/node_modules/nmrium/lib/component/reducer/Reducer.js',
  line: 348,
  column: 63,
  name: 'draft'
}
{
  source: 'webpack://_N_E/node_modules/nmrium/lib/component/reducer/actions/ZonesActions.js',
  line: 64,
  column: 38,
  name: null
}
{
  source: 'webpack://_N_E/node_modules/nmrium/lib/data/data2d/Spectrum2D/zones/detectZones.js',
  line: 4,
  column: 35,
  name: 'datum'
}
{
  source: 'webpack://_N_E/node_modules/nmrium/lib/data/data2d/Spectrum2D/zones/getDetectionZones.js',
  line: 18,
  column: 0,
  name: 'spectrum'
}
{
  source: 'webpack://_N_E/node_modules/nmrium/lib/data/data2d/Spectrum2D/zones/getDetectionZones.js',
  line: 47,
  column: 0,
  name: 'data'
}
hamed-musallam commented 1 year ago

this bug happen because the user visualize 2d FT spectra and then select the zone detection tool then switch to 2d Fid so the zone detection options panel still opened and he try to make zone detection which should not work.

in this case, what do we have to do?

hide the panel if the selected 2d spectrum is not FT or check before making the zone detection and display a message if it is not FT

hamed-musallam commented 1 year ago

@lpatiny WDT?

lpatiny commented 1 year ago

If it is easy to implement, I think when changing the spectrum we could systematically reset the tool to zoom (this means changing the spectrum for the same nucleus or changing the nucleus).

targos commented 1 year ago

I'm able to reproduce without using the zone detection tool.

Just go to https://dev.nmrium.org/#/SamplesDashboard/d3ubedj4/Viewcytisine2ddatacytisine2dHMBC_HN_Cytisinjson and click this button in the spectra list: CleanShot 2023-06-26 at 14 57 41

targos commented 1 year ago

I think this was actually a duplicate of https://github.com/cheminfo/nmrium/issues/2411 ?