Hotfix: Use local mod function instead of external dependency to fix rendering issue
All checks were successful
Deploy to Production / deploy (push) Successful in 5s

This commit is contained in:
2026-02-15 22:31:50 +01:00
parent ea54dfcf46
commit 4335938956
2 changed files with 11 additions and 3 deletions

View File

@@ -5,10 +5,18 @@ import { useCube } from '../composables/useCube'
const { cubeState, initCube, rotateLayer, COLOR_MAP } = useCube() const { cubeState, initCube, rotateLayer, COLOR_MAP } = useCube()
const getFaceColors = (faceName) => { const getFaceColors = (faceName) => {
if (!cubeState.value || !cubeState.value[faceName]) return Array(9).fill('gray'); if (!cubeState.value || !cubeState.value[faceName]) {
// Return placeholder colors if state is not ready
return Array(9).fill('#333');
}
// cubeState.value[faceName] is a 3x3 matrix. // cubeState.value[faceName] is a 3x3 matrix.
// We need to flatten it. // We need to flatten it.
return cubeState.value[faceName].flat().map(c => COLOR_MAP[c]); try {
return cubeState.value[faceName].flat().map(c => COLOR_MAP[c] || 'gray');
} catch (e) {
console.error('Error mapping face colors', e);
return Array(9).fill('red'); // Error state
}
}; };
// ...ref(25) // ...ref(25)

View File

@@ -1,4 +1,4 @@
import { mod } from '@gkucmierz/utils'; const mod = (n, m) => ((n % m) + m) % m;
// Enum for colors/faces // Enum for colors/faces
export const COLORS = { export const COLORS = {