You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I didn't see this problem until I moved chess.js into a pinia store but that seemed to change how _positionCounts was running. I started getting this error:
TypeError: fen.split is not a function
at trimFen (chess.ts:535:14)
at Object.get (chess.ts:585:22)
at Proxy.toString ()
at toTypeString (shared.esm-bundler.js:40:48)
at toRawType (shared.esm-bundler.js:42:10)
at getTargetType (reactivity.esm-bundler.js:862:93)
at createReactiveObject (reactivity.esm-bundler.js:917:22)
at reactive (reactivity.esm-bundler.js:868:10)
at MutableReactiveHandler.get (reactivity.esm-bundler.js:464:44)
at Proxy.load (chess.ts:661:10)
The issue is here:
this._positionCounts = new Proxy({} as Record<string, number>, {
get: (target, position: string) =>
position === 'length'
? Object.keys(target).length // length for unit testing
: target?.[trimFen(position)] || 0,
When I add a console.log(position) I get the following:
rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1
chess.ts:590 __v_isReadonly
chess.ts:590 __v_isShallow
chess.ts:590 __v_isReadonly
chess.ts:590 __v_raw
chess.ts:590 __v_raw
chess.ts:590 __v_isRef
chess.ts:590 __v_isRef
chess.ts:590 __v_isReadonly
chess.ts:590 __v_raw
chess.ts:590 __v_skip
chess.ts:590 Symbol(Symbol.toStringTag)
It's the last one that causes trimFen(position) to throw the TypeError: fen.split is not a function
For now I have this quick and dirty fix:
get: (target, position: string) => {
console.log(typeof position);
if (typeof position === 'symbol') {
return void 0;
}
But TBH I don't fully understand the problem or cause.
The text was updated successfully, but these errors were encountered:
sgr-nz
added a commit
to NeverNerf-Studio/NeverNerf.Chess
that referenced
this issue
Feb 14, 2024
…le-store
Moved rarity styling into own scss file
Refactored the chessboard inputhandler and fixed various gameState issues
Removed chess.js temporarily and using own version to fix the Symbol bug I found, see: jhlywa/chess.js#446
Made router initialize the chessboard-store
Fixed asset-store.loading
I didn't see this problem until I moved chess.js into a pinia store but that seemed to change how _positionCounts was running. I started getting this error:
TypeError: fen.split is not a function
at trimFen (chess.ts:535:14)
at Object.get (chess.ts:585:22)
at Proxy.toString ()
at toTypeString (shared.esm-bundler.js:40:48)
at toRawType (shared.esm-bundler.js:42:10)
at getTargetType (reactivity.esm-bundler.js:862:93)
at createReactiveObject (reactivity.esm-bundler.js:917:22)
at reactive (reactivity.esm-bundler.js:868:10)
at MutableReactiveHandler.get (reactivity.esm-bundler.js:464:44)
at Proxy.load (chess.ts:661:10)
The issue is here:
this._positionCounts = new Proxy({} as Record<string, number>, {
get: (target, position: string) =>
position === 'length'
? Object.keys(target).length // length for unit testing
: target?.[trimFen(position)] || 0,
When I add a console.log(position) I get the following:
rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1
chess.ts:590 __v_isReadonly
chess.ts:590 __v_isShallow
chess.ts:590 __v_isReadonly
chess.ts:590 __v_raw
chess.ts:590 __v_raw
chess.ts:590 __v_isRef
chess.ts:590 __v_isRef
chess.ts:590 __v_isReadonly
chess.ts:590 __v_raw
chess.ts:590 __v_skip
chess.ts:590 Symbol(Symbol.toStringTag)
It's the last one that causes trimFen(position) to throw the TypeError: fen.split is not a function
For now I have this quick and dirty fix:
get: (target, position: string) => {
console.log(typeof position);
if (typeof position === 'symbol') {
return void 0;
}
But TBH I don't fully understand the problem or cause.
The text was updated successfully, but these errors were encountered: