anse icon indicating copy to clipboard operation
anse copied to clipboard

Setting type "toggle" doesn't work properly in the first time

Open conql opened this issue 2 years ago • 0 comments

What operating system are you using?

Windows, Android

What browser are you using?

Edge

Describe the bug

I create a custom provider with a setting type "toggle" as following:

      {
        key: 'browsing',
        name: 'Browsing',
        description: '是否联网',
        type: 'toggle',
        default: false,
      },

It causes errors when it's the first time trying to modify this setting. It then blocks the setting panel and users cannot modify other settings properly.

However, when the modification is saved and the page is reloaded, this error is gone.

What provider are you using?

Others (Specify in description)

What prompt did you enter?

No response

Console Logs

web.5717ee6e.js:1  Uncaught TypeError: Cannot destructure property 'checked' of 'n' as it is undefined.
    at Jt (SettingsSidebar.b58c0e0a.js:7:14076)
    at dispatchChangeEvent (SettingsSidebar.b58c0e0a.js:7:38715)
    at kt.executeActions (chunk-LAWKLQEP.ebe166cb.js:1:15679)
    at kt.performTransitionEffects (chunk-LAWKLQEP.ebe166cb.js:1:17642)
    at kt.performStateChangeEffects (chunk-LAWKLQEP.ebe166cb.js:1:17801)
    at kt.transition (chunk-LAWKLQEP.ebe166cb.js:1:18658)
    at chunk-LAWKLQEP.ebe166cb.js:1:18213
    at Object.setChecked (SettingsSidebar.b58c0e0a.js:7:36426)
    at SettingsSidebar.b58c0e0a.js:7:39078
    at web.5717ee6e.js:1:3136

Participation

  • [X] I am willing to submit a pull request for this issue.

conql avatar Jul 02 '23 06:07 conql