-
Notifications
You must be signed in to change notification settings - Fork 111
fix(timeline): Filter links with SQL and only show filter-compatible results #1346
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -140,9 +140,9 @@ function RequestRecentLinks(options) { | |
return RequestExpect("RECENT_LINKS_REQUEST", "RECENT_LINKS_RESPONSE", options); | ||
} | ||
|
||
function RequestMoreRecentLinks(beforeDate) { | ||
function RequestMoreRecentLinks(beforeDate, filter = "") { | ||
return RequestRecentLinks({ | ||
data: {beforeDate}, | ||
data: {beforeDate, filter}, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. just to make sure, this is for infinite scrolling yes? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yup. It's to include the query for fetching more when infinitely scrolling. |
||
append: true, | ||
meta: {skipPreviewRequest: true} | ||
}); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -164,7 +164,10 @@ module.exports.selectHistory = createSelector( | |
return { | ||
Spotlight: Object.assign({}, Spotlight, {rows}), | ||
Filter, | ||
History | ||
History: Object.assign({}, History, { | ||
// Only include rows that are less filtered than the current filter | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the comment is kind of unclear - could you explain? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A query of "query" is more filtered/specific than a query of "qu" which is more specific than "". If the current query is "que" it would include rows for "" and "qu" but not "query" because "query" is more specific. This is desired because the user might be searching for "queso". |
||
rows: History.rows.filter(val => Filter.query.indexOf(val.filter) === 0) | ||
}) | ||
}; | ||
} | ||
); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question: how come we're using the blank string from
filterClause
here?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The other Clauses start with "AND ..." because they're chaining to the
WHERE
. This is the same except there's a dynamic number of chains based on how many tokens are being used, e.g., " AND token1 ... AND token2 ... AND token3 ..." The empty string is the initial value so that the subsequent token clauses can be concatenated.