Skip to content

Commit

Permalink
limit should be a number, not a string
Browse files Browse the repository at this point in the history
  • Loading branch information
NAR8789 committed Oct 15, 2020
1 parent 79e9484 commit bbba47c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/js/storage.js
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ module.exports = {
// Select the top posts for every possible sort method, to give us a limited
// index of the posts that each filter method would select.
//
follow.actualLimit = follow.limit || POSTS_IN_MAIN_INDEX
follow.actualLimit = follow.limit ?? POSTS_IN_MAIN_INDEX
follow.posts = frago.master(meta,
meta.sortBy ? [meta.sortBy] : ['publishedAt', 'updatedAt'],
follow.actualLimit)
Expand Down
4 changes: 2 additions & 2 deletions src/js/view.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ const FollowForm = (match, setup, isNew) => ({follows}, actions) => {
<div>
<label for="limit" class="optional">Limit</label>
<input type="number" id="limit" value={follow.limit} min='0' step='1'
oninput={e => follow.limit = e.target.value} />
oninput={e => follow.limit = e.target.value ? parseInt(e.target.value) : undefined} />
<p class="note">Number of recent feed entries to show. (If left blank, defaults to 10)</p>
</div>

Expand Down Expand Up @@ -423,7 +423,7 @@ const ListFollow = ({ location, match }) => ({follows}, actions) => {
{follow.posts instanceof Array && follow.posts.length > 0 &&
<div class="post">
<ol class="title">{(showReposts ? follow.posts : follow.posts.filter(x => !x.author || x.author === follow.author)).
slice(0, follow.actualLimit || 10).map(f => {
slice(0, follow.actualLimit ?? 10).map(f => {
let postAge = timeAgo(f[sortPosts], now)
return <li class={timeDarkness(f[sortPosts], now)}>
{f.author && f.author !== follow.author && <span class="author">{f.author}</span>}
Expand Down

0 comments on commit bbba47c

Please sign in to comment.