Cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

status of the element in settings page do not refresh accordingly

ANSWERED

as described on API here

“changes from the companion application will trigger events to be emitted in the settings view”

 

but I can NOT have them refreshed accordingly.
can anyone tell me how to refresh them from companion?
e.g.
companion/index.js
settingsStorage.clear();
settingsStorage.setItem("alwayson", JSON.stringify("false"));

settings/index.jsx
<Toggle settingsKey="alwayson" label="Keep Backlight Always On" />

no matter what I do, the toggle button keep displaying as "on", "true"
after first user clicking, it works and sending out value correctly, the problem happens on the VERY FIRST run
do I have some code to force refresh them and make them display accordingly?

I've tried import settingsStorage in settings/index.jsx like this but failed.
import { settingsStorage } from "settings";

Untitled.png

Best Answer
0 Votes
1 BEST ANSWER

Accepted Solutions

I haven't worked with the toggle component yet, but are you certain that you are sending in the correct value?  JSON.stringify("false") is going to send in ""false"", which might evaluate to true.  Do you mean to send in JSON.stringify(false)?

View best answer in original post

Best Answer
2 REPLIES 2

I haven't worked with the toggle component yet, but are you certain that you are sending in the correct value?  JSON.stringify("false") is going to send in ""false"", which might evaluate to true.  Do you mean to send in JSON.stringify(false)?

Best Answer

Oh, my bad. I've tried JSON.stringify(false) and confirmed it works!

Thank you!

Now my first app is ready for review.

Best Answer
0 Votes