Time Controlled Presets/macros drop-downs do not populate on some devices

オープン 初心者向け
#5,840 コメント 12 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
70/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
javascript
領域
frontend

調査の方向性

settings_time.htm の populatePresets(fromls) から始めます。ここでは、スマートフォンのブラウザーで localStorage.getItem("wledP") が null を返すことがあります。キャッシュされたデータの経路と /presets.json の取得経路を比較し、その後、スマートフォンとワークステーションのブラウザーで再現します。報告されたデバイスすべてで、プリセットとマクロのドロップダウンが一貫して表示されれば完了です。

索引モデルが issue の本文から書いたものです。

説明

bug cannot reproduce
What happened?

The drop-down to select preset shows empty on devices like phones vs workstation browsers. In settings_time.htm the line json = JSON.parse(localStorage.getItem("wledP")); is null when running off my phone's browser.

To Reproduce Bug

Try it off other devices

Expected Behavior

Presets should be getting loaded for drop-downs across range of devices

Install Method

Self-Compiled

What version of WLED?

WLED 17.0.0-devV5 (2607201)

Which microcontroller/board are you seeing the problem on?

ESP32-C3

Relevant log/trace output

Anything else?

I believe I found a fix- on settings_time.htm I updated populatePresets(fromls) to...

function populatePresets(fromls) { let json = null; 
	if (fromls) { 
		try { 
			json = JSON.parse(localStorage.getItem("wledP")); 
		} catch (e) { 
			console.log("Unable to parse cached presets:", e); 
		} 
	}
	if (json) { 
		onPresetsLoaded(json); 
		return; 
	} 
	fetch(getURL("/presets.json")) 
		.then(response => { 
			if (!response.ok) {
				 throw new Error("HTTP " + response.status);
			} return response.json(); 
		}) 
		.then(json => { 
			try { 
				localStorage.setItem("wledP", JSON.stringify(json)); 
			} catch (e) {
				console.log("Unable to cache presets:", e); 
			} 
			onPresetsLoaded(json); 
		}) 
		.catch(error => { 
			console.log("Unable to load presets:", error); 
			showToast("Unable to load presets", true);
		}); }
Code of Conduct
  • I agree to follow this project's Code of Conduct
主要言語
C++
スター
18.8k
フォーク
4.4k
平均マージ
3日 9時間
マージ済み PR(30日)
13

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

wled/WLED のほかの issue

wled/WLED の issue をすべて見る

似ている issue

C++ の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。