Skip to content

Fixed some bugs in getArray#631

Merged
TheJeran merged 2 commits intomainfrom
jp/getarray
Apr 15, 2026
Merged

Fixed some bugs in getArray#631
TheJeran merged 2 commits intomainfrom
jp/getarray

Conversation

@TheJeran
Copy link
Copy Markdown
Collaborator

There were soem bugs

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread next.config.ts
Comment on lines 71 to 72
if (isCacheValid) {
const chunkData = cachedChunk.compressed ? DecompressArray(cachedChunk.data) : cachedChunk.data.slice();
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

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.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This hasn't been an issue thus far, so I don't wanna deal with it right now.

Comment thread src/components/zarr/GetArray.ts
@TheJeran TheJeran merged commit 3d6831d into main Apr 15, 2026
6 checks passed
@TheJeran TheJeran deleted the jp/getarray branch April 17, 2026 07:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant