zeldadungeon / maps

Interactive maps for Zelda games
40 stars 18 forks source link

show error indicator in popups if wiki content fails to load #102

Closed slaurent22 closed 1 year ago

slaurent22 commented 1 year ago

Summary

Before this change, popups would remain in the loading state with the spinning icon if the wiki fetch fails.

This change introduces ZDPopup.loadContentFromQuery which drives popup content management for queried data. A "query" is just a Promise that resolves to a string, and rejects if it ultimately fails. A query can make chained calls in cases of fallbacks and redirects, as long as a string is returned in the end.

Testing

Given https://github.com/zeldadungeon/maps/issues/88 , I can't do full end-to-end testing locally. But I was able to mock out query results for a few different cases. The error screenshots are real though!

Case: Summary

summary-mock-response summary-error

Case: Section

section-mock-response section-error

Case: Page Content

page-content-mock-response page-content-error

Case: Map Page

map-page-mock-response map-page-error