Skip to content

Commit

Permalink
refactor: remove map spectra
Browse files Browse the repository at this point in the history
  • Loading branch information
hamed-musallam committed Nov 30, 2023
1 parent 1dfece8 commit 7e8a618
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 31 deletions.
4 changes: 0 additions & 4 deletions src/NMRiumWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down Expand Up @@ -40,9 +39,6 @@ export default function NMRiumWrapper() {

const { workspace, preferences, defaultEmptyMessage } = usePreferences();
const dataChangeHandler = useCallback<NMRiumChangeCb>((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,
Expand Down
11 changes: 1 addition & 10 deletions src/hooks/useLoadSpectra.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<ParsingOptions> = {
onLoadProcessing: { autoProcessing: true },
Expand All @@ -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[]) {
Expand All @@ -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;
}

Expand Down
17 changes: 0 additions & 17 deletions src/utilities/mapSpectra.ts

This file was deleted.

0 comments on commit 7e8a618

Please sign in to comment.