Fix purple
This commit is contained in:
parent
362b96b8ee
commit
4cc588cac4
2 changed files with 62 additions and 5 deletions
|
|
@ -56,8 +56,11 @@ export function useClickedListings() {
|
|||
.filter((url): url is string => typeof url === 'string');
|
||||
setClickedUrls(new Set(urls));
|
||||
})
|
||||
.catch(() => {
|
||||
// Visited history is a convenience; a failed load just starts the session empty.
|
||||
.catch((error) => {
|
||||
// Visited history is a convenience; a failed load just starts the session empty. Still
|
||||
// worth surfacing: a silent failure here is indistinguishable from "user visited nothing",
|
||||
// which is how a proxy 404 on this collection went unnoticed for weeks.
|
||||
console.warn('Failed to load visited listings:', error);
|
||||
});
|
||||
return () => {
|
||||
cancelled = true;
|
||||
|
|
@ -74,9 +77,12 @@ export function useClickedListings() {
|
|||
if (!uid) return; // anonymous: recolour for the session, nothing to persist
|
||||
pb.collection(CLICKED_LISTINGS_COLLECTION)
|
||||
.create({ user: uid, url })
|
||||
.catch(() => {
|
||||
// Ignore duplicate-index conflicts and transient failures; local state already
|
||||
// reflects the click, and a missed write only means it won't persist to the next visit.
|
||||
.catch((error: unknown) => {
|
||||
// A 400 is the idx_clicked_listings_user_url unique index rejecting a re-click that raced
|
||||
// another tab: local state already reflects it, so it is expected and not worth reporting.
|
||||
// Anything else means the click will not survive a reload, which the user does notice.
|
||||
if ((error as { status?: number })?.status === 400) return;
|
||||
console.warn('Failed to persist visited listing:', error);
|
||||
});
|
||||
}, []);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue