mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-23 23:19:40 +01:00
fix: toast not appearing when search results null
This commit is contained in:
@@ -98,20 +98,19 @@ export const Container = ({
|
|||||||
data[0].data ? db.notes.all : data,
|
data[0].data ? db.notes.all : data,
|
||||||
text,
|
text,
|
||||||
);
|
);
|
||||||
|
if (!searchResult || searchResult.length === 0) {
|
||||||
if (!searchResults && searchResults.length < 0) {
|
ToastEvent.show('No search results found for ' + text, 'error');
|
||||||
ToastEvent.show('No search results found', 'error', 3000, () => {}, '');
|
|
||||||
return;
|
return;
|
||||||
|
} else {
|
||||||
|
dispatch({
|
||||||
|
type: ACTIONS.SEARCH_RESULTS,
|
||||||
|
results: {
|
||||||
|
type,
|
||||||
|
results: searchResult,
|
||||||
|
keyword: text,
|
||||||
|
},
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
dispatch({
|
|
||||||
type: ACTIONS.SEARCH_RESULTS,
|
|
||||||
results: {
|
|
||||||
type,
|
|
||||||
results: searchResult,
|
|
||||||
keyword: text,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const onBlur = () => {
|
const onBlur = () => {
|
||||||
|
|||||||
@@ -206,7 +206,14 @@ export const Menu = ({
|
|||||||
inputRef.current?.setNativeProps({
|
inputRef.current?.setNativeProps({
|
||||||
text: '',
|
text: '',
|
||||||
});
|
});
|
||||||
dispatch({type: ACTIONS.SEARCH_RESULTS, results: []});
|
dispatch({
|
||||||
|
type: ACTIONS.SEARCH_RESULTS,
|
||||||
|
results: {
|
||||||
|
type: null,
|
||||||
|
results: [],
|
||||||
|
keyword: null,
|
||||||
|
},
|
||||||
|
});
|
||||||
}
|
}
|
||||||
item.func();
|
item.func();
|
||||||
}}
|
}}
|
||||||
|
|||||||
@@ -7,17 +7,15 @@ async function read(key, isArray = false) {
|
|||||||
let data;
|
let data;
|
||||||
if (isArray) {
|
if (isArray) {
|
||||||
data = await getArray(key);
|
data = await getArray(key);
|
||||||
data.push('hello');
|
|
||||||
} else {
|
} else {
|
||||||
data = await FastStorage.getMap(key);
|
data = await FastStorage.getMap(key);
|
||||||
}
|
}
|
||||||
console.log('READ', data, key);
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function write(key, data) {
|
async function write(key, data) {
|
||||||
if (data.length !== undefined) {
|
if (data.length !== undefined) {
|
||||||
console.log(data, key);
|
|
||||||
return await setArray(key, data);
|
return await setArray(key, data);
|
||||||
} else {
|
} else {
|
||||||
return await FastStorage.setMap(key, data);
|
return await FastStorage.setMap(key, data);
|
||||||
|
|||||||
Reference in New Issue
Block a user