fix ItemPage safeImageUrl loading bug
When you navigated directly to ItemPage, the new `safeImageUrl` function would crash during the loading state, because it was trying to safe-ify `undefined`. Now, I've just made `safeImageUrl` more resilient to that particular kind of unexpected input, by passing through null-y values without change.
This commit is contained in:
parent
dd4f34ef73
commit
d2671d0fa6
1 changed files with 4 additions and 0 deletions
|
@ -65,6 +65,10 @@ export function Heading2({ children, ...props }) {
|
|||
* safeImageUrl returns an HTTPS-safe image URL for Neopets assets!
|
||||
*/
|
||||
export function safeImageUrl(urlString) {
|
||||
if (urlString == null) {
|
||||
return urlString;
|
||||
}
|
||||
|
||||
const url = new URL(urlString);
|
||||
|
||||
if (url.origin === "http://images.neopets.com") {
|
||||
|
|
Loading…
Reference in a new issue