Skip to content

Commit c4fcdae

Browse files
authored
fix(saves): update inputs to allow overzealous counts (#80)
* fix(saves): update inputs to allow overzealous counts * fix(comment): adding a comment about why we limit to 20
1 parent 76dbca1 commit c4fcdae

File tree

2 files changed

+45
-10
lines changed

2 files changed

+45
-10
lines changed

src/api/desktop/recent-saves/inputs.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,15 @@ export const setDefaultsAndCoerceTypes = (
4040
...stringParams,
4141
};
4242

43+
let count = parseInt(withDefaults.count, 10);
44+
if (count > 20) {
45+
// versions of Firefox are asking for 88 items, but this code used to reject anything above 20 for an unknown reason.
46+
// so to maintain that logic we limit the count to 20 items if firefox asks for more.
47+
count = 20;
48+
}
49+
4350
return {
44-
count: parseInt(withDefaults.count, 10),
51+
count: count,
4552
};
4653
};
4754

src/generated/graphql/types.ts

Lines changed: 37 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ export type CachedImageInput = {
154154
fileType?: InputMaybe<ImageFileType>;
155155
/** Height of the image */
156156
height?: InputMaybe<Scalars['Int']>;
157-
/** Id of the image in the returned result set */
157+
/** ID that will be added to the generated response object so you can find it. NOTE: Can be any string that you like, it will be added to the response so you can use it when consuming it */
158158
id: Scalars['ID'];
159159
/** Quality of the image in whole percentage, 100 = full, quality 50 = half quality */
160160
qualityPercentage?: InputMaybe<Scalars['Int']>;
@@ -183,6 +183,8 @@ export type Collection = {
183183
*/
184184
language: CollectionLanguage;
185185
partnership?: Maybe<CollectionPartnership>;
186+
/** The preview of the collection */
187+
preview: PocketMetadata;
186188
publishedAt?: Maybe<Scalars['DateString']>;
187189
/**
188190
* Provides short url for the given_url in the format: https://pocket.co/<identifier>.
@@ -301,8 +303,12 @@ export type CorpusItem = {
301303
image: Image;
302304
/** The image URL for this item's accompanying picture. */
303305
imageUrl: Scalars['Url'];
306+
/** Experimental data point that could imply either an expiry date or an urgency to be shown. */
307+
isTimeSensitive: Scalars['Boolean'];
304308
/** What language this item is in. This is a two-letter code, for example, 'EN' for English. */
305309
language: CorpusLanguage;
310+
/** The preview of the search result */
311+
preview: PocketMetadata;
306312
/** The name of the online publication that published this story. */
307313
publisher: Scalars['String'];
308314
/** The user's saved item, from the Corpus Item, if the corpus item was saved to the user's saves */
@@ -451,8 +457,8 @@ export type CorpusSearchHighlights = {
451457
/** A node in a CorpusSearchConnection result */
452458
export type CorpusSearchNode = {
453459
__typename?: 'CorpusSearchNode';
454-
/** The preview of the search result */
455-
preview: PocketMetadata;
460+
/** Attaches the item so we can use the preview field */
461+
item?: Maybe<Item>;
456462
/** Search highlights */
457463
searchHighlights?: Maybe<CorpusSearchHighlights>;
458464
};
@@ -469,7 +475,11 @@ export type CorpusSearchQueryString = {
469475
query: Scalars['String'];
470476
};
471477

472-
/** Sort scheme for Corpus Search. Defaults to showing most relevant results first. */
478+
/**
479+
* Sort scheme for Corpus Search. Defaults to showing most relevant results first.
480+
* Only relevant for indices which use keyword search.
481+
* **Semantic search will ignore any inputs and use default only.**
482+
*/
473483
export type CorpusSearchSort = {
474484
sortBy: CorpusSearchSortBy;
475485
sortOrder?: InputMaybe<SearchItemsSortOrder>;
@@ -828,6 +838,8 @@ export type Item = {
828838
* @deprecated Clients should not use this
829839
*/
830840
contentLength?: Maybe<Scalars['Int']>;
841+
/** If the item is in corpus allow the item to reference it. Exposing curated info for consistent UX */
842+
corpusItem?: Maybe<CorpusItem>;
831843
/** The date the article was published */
832844
datePublished?: Maybe<Scalars['DateString']>;
833845
/** The date the parser resolved this item */
@@ -904,7 +916,7 @@ export type Item = {
904916
* @deprecated Use a domain as the identifier instead
905917
*/
906918
originDomainId?: Maybe<Scalars['String']>;
907-
/** The client preview/display logic for this url */
919+
/** The client preview/display logic for this url. The requires for each object should be kept in sync with the sub objects requires field. */
908920
preview?: Maybe<PocketMetadata>;
909921
/** A server generated unique reader slug for this item based on itemId */
910922
readerSlug: Scalars['String'];
@@ -1961,9 +1973,12 @@ export type PocketMetadata = {
19611973
};
19621974

19631975
export enum PocketMetadataSource {
1976+
Collection = 'COLLECTION',
1977+
CuratedCorpus = 'CURATED_CORPUS',
19641978
Oembed = 'OEMBED',
19651979
Opengraph = 'OPENGRAPH',
1966-
PocketParser = 'POCKET_PARSER'
1980+
PocketParser = 'POCKET_PARSER',
1981+
Syndication = 'SYNDICATION'
19671982
}
19681983

19691984
/**
@@ -2165,7 +2180,12 @@ export type Query = {
21652180
/** List all topics that the user can express a preference for. */
21662181
recommendationPreferenceTopics: Array<Topic>;
21672182
scheduledSurface: ScheduledSurface;
2168-
/** Search Pocket's corpus of recommendations and collections. */
2183+
/**
2184+
* Search Pocket's corpus of recommendations and collections.
2185+
* Note that sort will have no effect unless using keyword
2186+
* semantic search will always be returned in relevance order
2187+
* (most relevant first).
2188+
*/
21692189
searchCorpus?: Maybe<CorpusSearchConnection>;
21702190
/**
21712191
* Resolve data for a Shared link, or return a Not Found
@@ -2622,7 +2642,7 @@ export type SavedItem = RemoteEntity & {
26222642
tags?: Maybe<Array<Tag>>;
26232643
/** The title for user saved item. Set by the user and if not, set by the parser. */
26242644
title?: Maybe<Scalars['String']>;
2625-
/** The url the user saved to their list */
2645+
/** key field to identify the SavedItem entity in the ListApi service */
26262646
url: Scalars['String'];
26272647
};
26282648

@@ -3303,12 +3323,20 @@ export type SyndicatedArticle = {
33033323
localeLanguage?: Maybe<Scalars['String']>;
33043324
/** Primary image to use in surfacing this content */
33053325
mainImage?: Maybe<Scalars['String']>;
3326+
/**
3327+
* The Item entity representing the original content this was
3328+
* syndicated from.
3329+
*/
3330+
originalItem: Item;
33063331
/** The item id of the article we cloned */
33073332
originalItemId: Scalars['ID'];
3333+
/** The preview of the syndicated article */
3334+
preview: PocketMetadata;
33083335
/** AWSDateTime — Format: YYYY-MM-DDThh:mm:ss.sssZ */
33093336
publishedAt: Scalars['String'];
33103337
/** The manually set publisher information for this article */
33113338
publisher?: Maybe<Publisher>;
3339+
/** The canonical publisher URL. Automatically set at time of creation but can be changed by editor. */
33123340
publisherUrl: Scalars['String'];
33133341
/** Recommend similar syndicated articles. */
33143342
relatedEndOfArticle: Array<CorpusRecommendation>;
@@ -3438,7 +3466,7 @@ export type Topic = {
34383466
displayName: Scalars['String'];
34393467
/** If returned a note to show to the user about the topic */
34403468
displayNote?: Maybe<Scalars['String']>;
3441-
/** The id of the topic */
3469+
/** The legacy UUID id of the topic */
34423470
id: Scalars['ID'];
34433471
/** Whether or not clients should show this topic ot users */
34443472
isDisplayed: Scalars['Boolean'];

0 commit comments

Comments
 (0)