Commit 89c6d398 authored by Alejandro Celaya's avatar Alejandro Celaya Committed by Alejandro Celaya

Stream: make sure we fall back to empty string when query is not present

parent e9f52392
...@@ -53,7 +53,7 @@ function StreamView({ api, toastMessenger }: StreamViewProps) { ...@@ -53,7 +53,7 @@ function StreamView({ api, toastMessenger }: StreamViewProps) {
// Sort the stream so that the newest annotations are at the top // Sort the stream so that the newest annotations are at the top
store.setSortKey('Newest'); store.setSortKey('Newest');
store.clearAnnotations(); store.clearAnnotations();
loadAnnotations(currentQuery).catch(err => { loadAnnotations(currentQuery ?? '').catch(err => {
toastMessenger.error(`Unable to fetch annotations: ${err.message}`); toastMessenger.error(`Unable to fetch annotations: ${err.message}`);
}); });
}, [currentQuery, loadAnnotations, store, toastMessenger]); }, [currentQuery, loadAnnotations, store, toastMessenger]);
......
...@@ -97,6 +97,9 @@ describe('StreamView', () => { ...@@ -97,6 +97,9 @@ describe('StreamView', () => {
'reply_2', 'reply_2',
'reply_3', 'reply_3',
]); ]);
// Assert that we use an empty string as query, when the `q` param is not set
assert.calledWith(fakeSearchFilter.toObject, '');
}); });
it('displays an error if fetching annotations fails', async () => { it('displays an error if fetching annotations fails', async () => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment