diff --git a/src/NMRiumWrapper.tsx b/src/NMRiumWrapper.tsx index 0b62640..fd7a67e 100644 --- a/src/NMRiumWrapper.tsx +++ b/src/NMRiumWrapper.tsx @@ -7,7 +7,6 @@ import { useLoadSpectra } from './hooks/useLoadSpectra'; import { usePreferences } from './hooks/usePreferences'; import { useWhiteList } from './hooks/useWhiteList'; import AboutUsModal from './modal/AboutUsModal'; -import { mapSpectra } from './utilities/mapSpectra'; const styles: Record<'container' | 'loadingContainer', CSSProperties> = { container: { @@ -40,9 +39,6 @@ export default function NMRiumWrapper() { const { workspace, preferences, defaultEmptyMessage } = usePreferences(); const dataChangeHandler = useCallback((state, source) => { - //TODO: remove map spectra once this issue resolved - //a temporary fix by remove the `logger` and `keepSource` objects from each spectrum, this should removed once we solve the issue in nmr-load-save - state.data.spectra = mapSpectra(state.data.spectra); events.trigger('data-change', { state, source, diff --git a/src/hooks/useLoadSpectra.ts b/src/hooks/useLoadSpectra.ts index 3655cec..30e42fa 100644 --- a/src/hooks/useLoadSpectra.ts +++ b/src/hooks/useLoadSpectra.ts @@ -11,7 +11,6 @@ import { useCallback, useMemo, useState } from 'react'; import events from '../events'; import { getFileNameFromURL } from '../utilities/getFileNameFromURL'; import { isArrayOfString } from '../utilities/isArrayOfString'; -import { mapSpectra } from '../utilities/mapSpectra'; const PARSING_OPTIONS: Partial = { onLoadProcessing: { autoProcessing: true }, @@ -24,10 +23,7 @@ async function loadSpectraFromFiles(files: File[]) { const { nmriumState: { data }, } = await read(fileCollection, PARSING_OPTIONS); - //TODO: remove map spectra once this issue resolved - //a temporary fix by remove the `logger` and `keepSource` objects from each spectrum, this should removed once we solve the issue in nmr-load-save - const mapData = { ...data, spectra: mapSpectra(data?.spectra) }; - return mapData; + return data; } async function loadSpectraFromURLs(urls: string[]) { @@ -43,11 +39,6 @@ async function loadSpectraFromURLs(urls: string[]) { }, []); const { data } = await readFromWebSource({ entries }, PARSING_OPTIONS); - //TODO: remove map spectra once this issue resolved - //a temporary fix by remove the `logger` and `keepSource` objects from each spectrum, this should removed once we solve the issue in nmr-load-save - const mapData = { ...data, spectra: mapSpectra(data?.spectra) }; - return mapData; - return data; } diff --git a/src/utilities/mapSpectra.ts b/src/utilities/mapSpectra.ts deleted file mode 100644 index 9ddba56..0000000 --- a/src/utilities/mapSpectra.ts +++ /dev/null @@ -1,17 +0,0 @@ -/* eslint-disable @typescript-eslint/dot-notation */ -import { Spectrum } from 'nmr-load-save'; - -export function mapSpectra(spectra?: Spectrum[]) { - if (!spectra) return []; - - return spectra.map((spectrum) => { - const cloneSpectrum = { ...spectrum }; - if ('logger' in cloneSpectrum || 'keepSource' in cloneSpectrum) { - // eslint-disable-next-line @typescript-eslint/no-dynamic-delete - delete cloneSpectrum['logger']; - // eslint-disable-next-line @typescript-eslint/no-dynamic-delete - delete cloneSpectrum['keepSource']; - } - return cloneSpectrum; - }, []); -}