GoogleChromeLabs / GoogleChromeLabs/pwa-workshop-codelab

Undefined value of screens

Open
#2 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
166
Forks
224
PR merge metrics
No merged PRs in 30d

Description

In [actions.js](https://github.com/GoogleChromeLabs/pwa-workshop-codelab/blob/pwa06--service-worker-includes/js/lib/actions.js) below code is used to get the array with multiple screens..
```js
// Line 151 of actions.js, Branch: pwa06--service-worker-includes
const { screens } = await window.getScreens()
```
It throws below error when preview is triggered, as `window.getScreens` returns an array not an object..

![image](https://user-images.githubusercontent.com/55982424/117568750-dacd1100-b0df-11eb-9538-871d9063b805.png)

> Quick, fix to this error might be to just assign the array directly to `screens` variable, by removing curly braces
```js
const screens = await window.getScreens();
```
Alternatively, maybe global variable `screen` can be used to show the preview at correct position
![image](https://user-images.githubusercontent.com/55982424/117569132-c558e680-b0e1-11eb-9b2b-934125aed274.png)

Contributor guide

Open the contributing guide

Research direction

Start in js/lib/actions.js around line 151 and trigger the preview to inspect the value returned by window.getScreens(). Confirm whether the returned value matches the destructuring used there and verify the preview displays the screens at the intended position without an error.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend, web-dev
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.