RFC-0013: Favourites API#141
Conversation
|
|
||
| ## Summary | ||
|
|
||
| Products can query, add and remove bookmarked apps from the host's local product catalogue. The host exposes a subscription for the installed-product list and two mutations for adding/removing entries. Browse (the on-chain discovery product) receives privileged access without an explicit permission prompt. |
There was a problem hiding this comment.
Browse (the on-chain discovery product) receives privileged access without an explicit permission prompt.
We should mention why? Because it is our default discovery product.
|
|
||
| ## Motivation | ||
|
|
||
| The host maintains a local catalogue of products the user has bookmarked (starred). Today this data lives in the host's IndexedDB and is inaccessible to products. Browse — the primary discovery surface — cannot show which apps are already installed or let the user bookmark new ones without direct database access. |
There was a problem hiding this comment.
This could start by mentioning that hosts store data the products don't have access to, but would benefit from. Bookmarked apps is one such example.
The host maintains
We have three hosts today, Polkadot Desktop, Polkadot Web, and Polkadot Mobile, but only Desktop has bookmarks. Maybe rephrase to "Some hosts maintain".
|
|
||
| Exposing this catalogue: | ||
|
|
||
| 1. **Enables discovery UIs** — Browse can render install/uninstall affordances inline. |
|
|
||
| 1. **Enables discovery UIs** — Browse can render install/uninstall affordances inline. | ||
| 2. **Keeps the host authoritative** — mutations go through the host, which owns the storage schema and can enforce invariants. | ||
| 3. **Supports other products** — any product with permission can read the installed list (e.g. a dashboard, launcher, or analytics tool). |
There was a problem hiding this comment.
Agreed. I'd also tie this to DotNS being permissionless, anyone can publish a product, so discovery is essential. Browse and other products should also be able to help users find and keep track of apps that solve their problems.
| } | ||
| ``` | ||
|
|
||
| This mirrors the existing `ProductRecord` in the host's `products` table, exposing only the fields relevant to products. |
There was a problem hiding this comment.
I suggest starting with this sentence, and link to the relevant lines of code in polkadot-desktop as an example.
| - **Full-list delivery.** No pagination or filtered subscriptions. Acceptable for typical catalogue sizes (tens to low hundreds). | ||
| - **Browse coupling.** Implicit privilege for Browse assumes a well-known product identity. If Browse's DotNS identifier changes, the host must update its allowlist. | ||
|
|
||
| ## Alternatives |
There was a problem hiding this comment.
This is a straightforward API in my opinion, we can remove
| ## Unresolved Questions | ||
|
|
||
| 1. **Batch operations.** Should `host_favourites_add` accept multiple product IDs? |
There was a problem hiding this comment.
I can't think of a use case for this, but worth keeping it in mind.
| ### API | ||
|
|
||
| ```rust | ||
| enum FavouritesErr { |
There was a problem hiding this comment.
Should we return a specific error if the Host doesn't have a favourites table?
|
closed in favour of paritytech/truapi#16 |
RFC: Favourites API
Summary
Expose the host's local product catalogue to products. Three new methods:
host_favourites_subscribe(reactive list),host_favourites_add(bookmark a product), andhost_favourites_forget(remove a bookmark). Browse receives implicit privileged access.Checklist
docs/rfcs/0013-favourites-api.mdwith completed frontmatterdocs/rfcs/_index.mdwith a link to the new RFCrfc,proposalMotivation
Browse (on-chain discovery product) cannot display which apps the user has bookmarked or offer inline add/forget controls, because the host's product catalogue is locked in IndexedDB. This RFC exposes the catalogue through the Host API so any permitted product can read and manage favourites.