Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explicit Slice Names Required #3163

Merged
merged 1 commit into from
Oct 31, 2024
Merged

Explicit Slice Names Required #3163

merged 1 commit into from
Oct 31, 2024

Conversation

jameskerr
Copy link
Member

@jameskerr jameskerr commented Oct 31, 2024

Fixes #3161

The bug was caused by the nextjs build step obfuscating all the names of the symbols in the code. Some code introspects itself to get the name of its class, then lowercases and pluralizes it to become the key in the state object.

The snapshots slice in dev mode looks like this.

{
  snapshots: {...}
}

That key is derived from the class called Snapshot.

But when we build for production, that class becomes the single letter p.

So on zui insiders, the state object looks like.

{
  ps: {...}
}

There is other code that relies on there being a "snapshots" key in the state and that is where the error occurs.

This fix introduces a static, explicit name for the key, instead of the derived one. Looks like we will need to do this each time we introduce a new slice of state in this way.

@philrz philrz merged commit b61d012 into main Oct 31, 2024
4 checks passed
@philrz philrz deleted the explicit-slice-names branch October 31, 2024 22:44
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.

Stack trace: Cannot read properties of null (reading 'queryId')
2 participants