salemlf / hakubun

Cross-platform, third-party Japanese language learning app for use with WaniKani 🦀🐊
GNU General Public License v3.0
31 stars 7 forks source link

Cannot destructure property 'x1' of 'p[f]' as it is undefined. #400

Open salemlf opened 2 months ago

salemlf commented 2 months ago

Error

Error Message

Cannot destructure property 'x1' of 'p[f]' as it is undefined.

Stack Trace

TypeError: Cannot destructure property 'x1' of 'p[f]' as it is undefined.
    at https://localhost/assets/index-95050142.js:310:221023
    at Array.map (<anonymous>)
    at _F0 (https://localhost/assets/index-95050142.js:310:220989)
    at n7 (https://localhost/assets/index-95050142.js:38:17017)
    at Gm (https://localhost/assets/index-95050142.js:40:3139)
    at qS (https://localhost/assets/index-95050142.js:40:44817)
    at WS (https://localhost/assets/index-95050142.js:40:39774)
    at fU (https://localhost/assets/index-95050142.js:40:39702)
    at M5 (https://localhost/assets/index-95050142.js:40:39555)
    at uh (https://localhost/assets/index-95050142.js:40:35920)
    at $9 (https://localhost/assets/index-95050142.js:40:36724)
    at Hi (https://localhost/assets/index-95050142.js:38:3279)
    at https://localhost/assets/index-95050142.js:40:34250 

Bug/Error Report

What Caused the Bug/Error to Show Up?

It happened after swiping a card to the right, but idk why, since I had already swiped so many cards.

It's kinda funny for me to see the "cannot read property of undefined" error in a app.

Additional Info

Release Version

2.6.2-beta

Issue Created By

Gorfyx

Device Info

{
    "diskFree": 0,
    "diskTotal": 4561346560,
    "model": "SM-A055F",
    "operatingSystem": "android",
    "osVersion": "14",
    "androidSDKVersion": 34,
    "platform": "android",
    "manufacturer": "samsung",
    "isVirtual": false,
    "webViewVersion": "127.0.6533.103"
}
Shoghy commented 2 months ago

I don't know if this is helpful, but I will leave this comment just in case.

I think the error happens on this file and line: https://github.com/salemlf/hakubun/blob/8da4b09d34bab8578ad279620c065e0e0f0f5dda/src/components/PitchIllustration/PitchIllustration.tsx#L131

I think it, because is the only part of the code that does a destructure using brackets to access the property of an Object (To know this I ran this command on the project's directory grep -lEr '\{.+\}(( )+)?=(( )+)?[A-Za-z0-9]+\[' .) beside that, after minifying the code with Vite, there's only one file that has p[f] and the near code is this const{coords:p}=a,{x1:C,x2:F}=p[f].

I hope this is helpful to fix the problem.