-
Notifications
You must be signed in to change notification settings - Fork 25
Description
As the title said, the component didn't check if the feature id is empty, causing an undefined request sent in dynamic-created scenes.
Summary
- There is no empty-value check before the network request
- The component sends the request as soon as it was mounted
- The problems above caused an incorrect request sent, like
https://api.webstatus.dev/v1/features/undefined
This problem influences when the component is created dynamically (e.g. using reactive framework like Vue). In these case, the feature-id is delayed to be set, causing the problem.
Steps to reproduce
Online reproduce
- Open the online demo above
- wait for data load
- open DevTools
- pick a feature from the list
- You will see the failed (or cancelled) request in the Network panel.
Offline (minimal) reproduce
- Import the library (probably from a CDN, or you can also use npm)
- Open DevTools
- Run JavaScript:
document.body.append(document.createElement('baseline-status')) - You will see the request in the Network panel.
Expected behavior
The feature-id attribute should be checked whether it is empty or not
Actual behavior
The request was sent without checking if the value is falsy
Environment
baseline-status v1.1.1, sri=sha256-FEtothNmbgdolsd7g8pRU1Ws5e2jK4C+QUCi9MpY8G0=
Additional information
An online demo could be found at https://myappsbucket.apps.furieau.com/webstatic/standalone/Baseline%E7%8A%B6%E6%80%81%E6%9F%A5%E7%9C%8B%E5%99%A8.html
Update: There seemed to be a check in the file, however the problem still exists. Maybe this is a task-queue related problem? However I'm not very familiar about the lit framework, so it is hard for me to find out the exact reason. :( Sorry for the inconvenient I made
