You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The fetch member is temporarily set to crossFetch and there is no indication of the switch happening. So when accessing the object quickly after creation, an unauthenticated fetch might accidentally be used.
There is no error handling. Even though the code says we "don't care" whether something errors (presumably because of the fallback to crossFetch), the promise rejection will still go unhandled and cause application errors/warnings. And I'd be surprised if we really don't care.
Both issues can be mitigated by temporarily assigning a function to this.fetch that stores all of its calls until the fetch object resolves. Something like:
The code at
solid-client-notifications-js/src/notification.ts
Lines 93 to 118 in bcb53a4
seems to suffer from 2 issues at first sight:
fetch
member is temporarily set tocrossFetch
and there is no indication of the switch happening. So when accessing the object quickly after creation, an unauthenticated fetch might accidentally be used.crossFetch
), the promise rejection will still go unhandled and cause application errors/warnings. And I'd be surprised if we really don't care.Both issues can be mitigated by temporarily assigning a function to
this.fetch
that stores all of its calls until the fetch object resolves. Something like:and then upon setting
this.fetch
, calling allfetches
and resolve or reject depending on whether an error occurred or not.This holding pattern can also be abstracted into a utility function.
The text was updated successfully, but these errors were encountered: