Conversation
There was a problem hiding this comment.
Code Review
This pull request removes security headers from the Next.js configuration and updates the array fetching logic to support 2D chunk copying and conditional fetcher selection. Review feedback identifies that removing the Cross-Origin headers will break SharedArrayBuffer functionality. Furthermore, improvements are suggested for the cache validation logic to include scaling factor checks and for the fetcher selection to include a null-check on the store state to prevent runtime errors.
| if (isCacheValid) { | ||
| const chunkData = cachedChunk.compressed ? DecompressArray(cachedChunk.data) : cachedChunk.data.slice(); |
There was a problem hiding this comment.
The cache validation logic is missing a check for the scalingFactor. Since different chunks can be stored with different scaling factors, loading a cached chunk with a scaling factor that differs from the current global scalingFactor will result in incorrect data being copied into the array. By requiring the scaling factors to match, you ensure data consistency. If they don't match, the code will fall back to the else block where the chunk is re-fetched and the entire array is correctly rescaled.
There was a problem hiding this comment.
This hasn't been an issue thus far, so I don't wanna deal with it right now.
There were soem bugs