Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix missing return values in streaming #26233

Merged
merged 1 commit into from
Jul 28, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 5 additions & 3 deletions streaming/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -714,7 +714,7 @@ const startServer = async () => {
}

// If the payload already contains the `filtered` property, it means
// that filtering has been applied on the ruby on rails side, as
// that filtering has been applied on the ruby on rails side, as
// such, we don't need to construct or apply the filters in streaming:
if (Object.prototype.hasOwnProperty.call(payload, "filtered")) {
transmit(event, payload);
Expand Down Expand Up @@ -786,12 +786,12 @@ const startServer = async () => {
const filter_results = Object.values(req.cachedFilters).reduce((results, cachedFilter) => {
// Check the filter hasn't expired before applying:
if (cachedFilter.expires_at !== null && cachedFilter.expires_at < now) {
return;
return results;
}

// Just in-case JSDOM fails to find textContent in searchableContent
if (!searchableTextContent) {
return;
return results;
}

const keyword_matches = searchableTextContent.match(cachedFilter.regexp);
Expand All @@ -806,6 +806,8 @@ const startServer = async () => {
status_matches: null
});
}

return results;
}, []);

// Send the payload + the FilterResults as the `filtered` property
Expand Down