pln-planning-tools / Starmap

Roadmap Planning Tool
https://starmap.site
Other
20 stars 8 forks source link

Error when fetching roadmaps from service worker or cache on `pendingChild` API endpoint #345

Closed AlexxNica closed 1 year ago

AlexxNica commented 1 year ago

Bug reports are coming in from Slack from some people having issues loading roadmaps.

I tried to scan the problem and it seems to be related to fetching and caching from the service worker. It works fine if I reload the page using the browser shortcut to ignore cached content.

Shortcut to reload ignoring cached content:

Error message

Error fetching https://starmap.site/api/pendingChild?owner=filecoin-station&repo=desktop&issue_number=535&parentJson=%7B%22labels%22%3A%5B%22milestone%22%5D%2C%22completion_rate%22%3A0%2C%22due_date%22%3A%222023-02-28%22%2C%22html_url%22%3A%22https%3A%2F%2Fgithub.com%2Ffilecoin-station%2Froadmap%2Fissues%2F7%22%2C%22group%22%3A%22children%3A%22%2C%22title%22%3A%22Bacalhau%20Worker%20Module%20without%20Incentives%22%2C%22state%22%3A%22open%22%2C%22node_id%22%3A%22I_kwDOIUF5GM5YTQyp%22%2C%22parent%22%3A%7B%22state%22%3A%22open%22%2C%22group%22%3A%22root%22%2C%22title%22%3A%22Filecoin%20Station%202023%20Roadmap%22%2C%22html_url%22%3A%22https%3A%2F%2Fgithub.com%2Ffilecoin-station%2Froadmap%2Fissues%2F1%22%2C%22labels%22%3A%5B%22roadmap%22%5D%2C%22node_id%22%3A%22I_kwDOIUF5GM5U5JPE%22%2C%22completion_rate%22%3A0%2C%22due_date%22%3A%222023-12-31%22%7D%2C%22children%22%3A%5B%5D%7D: TypeError: Failed to fetch

Screenshot

image
SgtPooki commented 1 year ago

This was called out during the speed improvements. We've changed requests to the backend from POST to GET, and service worker / old pages may be still trying to POST, which will no longer work.

Note that we’ve changed requests to api/roadmap and api/pendingChild to GET from POST, so your service workers may alert you of some errors (“Failed to Fetch”), but you can unregister your service worker if this is the case by simply running (await navigator.serviceWorker.ready).unregister() in your browser’s dev tools.

SgtPooki commented 1 year ago

Users should be able to run

window.indexedDB.deleteDatabase('contentHashDB')
(await navigator.serviceWorker.ready).unregister()

in their browser console and then refresh to permanently get rid of the errors.

AlexxNica commented 1 year ago

@SgtPooki is there a way to fix this without making end users run commands on the browser console? It'd be a huge win for experience and security