Multisearch data storage POC
In this PoC I would like to discuss possible way to store data in redux store
// scenario: user inputs multi values up to 7 separated by comma. Click search
// goal: have data stored in redux to be used in multitab on search results
import { Loading } from '@/types/loadingState';
// 1: needs to validate number of imputs, dont let more then 7;
// 2: get each of values to search for and send 4 queries for each of them (drugs, mirna, chemicals, bioEntity)
// 3: save values to the store:
/** Current store of bioEntity,drugs,chemicals,mirna */
type FetchDataState<T, T2 = undefined> = {
data: T | T2;
loading: Loading;
error: Error;
};
// proposed new structure
type MultiSearchData<T, T2 = undefined> = {
searchQuery: string; // e.g Aspirin - it will allow us to use it in search tabs. Find desired data set by searchQuery (it's also tab name)
data: T | undefined;
loading: Loading; // it will be possible to use it in search tabs to show loading indicator
error: Error;
};
type MultiFetchDataState<T> = {
data: MultiSearchData<T>[];
loading: Loading;
error: Error;
};
// possible problems: if later we want to add search query for pin it might be tricky to store values and access them. Unless we agree to add separate field just for it