Feast "Saved from web" recipe state#16412
Open
andresilva-guardian wants to merge 4 commits into
Open
Conversation
andresilva-guardian
changed the base branch from
main
to
afs/feast-contextual-nudge-braze-banners
July 20, 2026 09:17
…ze network requests
andresilva-guardian
marked this pull request as ready for review
July 21, 2026 15:06
|
Hello 👋! When you're ready to run Chromatic, please apply the You will need to reapply the label each time you want to run Chromatic. |
…722105844 in package.json and pnpm-lock.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this change?
We have added support for checking and updating whether a recipe has already been saved to a reader's Feast "Saved from web" list.
On the server, we added a new proxy route (
/api/saved-from-web) that forwards a reader's bearer token straight through to the Feast API's/v2/saved-from-webendpoints, viahandleGetSavedFromWeb(GET, checks which recipe ids are saved) andhandlePutSavedFromWebRecipe(PUT, adds a recipe to the list). We went through DCR's own server rather than calling the Feast API directly from the browser, since this sidesteps needing Feast API-side CORS configuration for browser origins.On the client, we added
src/lib/feast/savedFromWeb.tswithgetFeastSavedFromTheWebRecipesandaddFeastRecipeToSavedFromWebList, which call the new proxy routes.getFeastSavedFromTheWebRecipescaches in-flight and resolved requests by user id and recipe ids, so that when multipleFeastContextualNudgeislands hydrate on the same page, only one network request is made for the whole batch of recipe ids rather than one per nudge.We updated
ArticleRendererto compute the full list of recipe ids that will get a nudge on the page upfront and pass it to everyFeastContextualNudgeinstance asallNudgeRecipeIds. EachFeastContextualNudgethen uses this, together with the signed-in reader's id and access token, to fetch whether its own recipe is already saved, and passes anisRecipeSavedflag through to the Braze banner.We also added a
SaveFeastRecipeByIdmessage type toBrazeBannersSystem, so a Braze banner can ask DCR to save a Feast recipe to the reader's list on their behalf. This callsaddFeastRecipeToSavedFromWebListwith the reader's access token, logs the outcome, and posts the result back to the banner along with a custom Braze event (braze_banner_save_feast_recipe).Why?
We want Feast contextual nudges (and the Braze banners they render) to reflect whether a reader has already saved a given recipe from the web, and to let readers save a recipe directly from the banner. Batching the "is this saved?" check across all nudges on a page, and caching it, avoids making a separate network request per nudge when several appear on the same article.
How has this change been tested?
Screenshots