[NTP] Fixes blank page on NTP due to Brave News ads removal (#36849)

The fixes a NTP crash crash for legacy profiles with cached News feeds
containing removed Brave News ads items.
This commit is contained in:
Aleksei Seren
2026-05-29 20:46:42 -05:00
committed by GitHub
parent ac2c15e6b0
commit 5a2c0c1dab
@@ -73,6 +73,14 @@ const maybeLoadFeed = (view?: FeedView) => {
const feed: FeedV2 = JSON.parse(data)
// Remove any cached feed whose items include a type no longer supported
// in the FeedItemV2.
if (feed.items?.some(item => !item.article && !item.cluster && !item.discover && !item.hero)) {
localStorage.removeItem(FEED_KEY)
sessionStorage.removeItem(FEED_KEY)
return undefined
}
// If we loaded the feed from localStorage, and it's too old remove it from
// storage and return undefined.
if (isTooOld(feed)) {