Skip to content

Wait for WebAssembly setup before writing SPZ - #448

Open
oscarlorentzon wants to merge 1 commit into
sparkjsdev:mainfrom
oscarlorentzon:spz-write-await-wasm
Open

oscarlorentzon wants to merge 1 commit into
sparkjsdev:mainfrom
oscarlorentzon:spz-write-await-wasm

Conversation

@oscarlorentzon

Copy link
Copy Markdown
Collaborator

writeSpz called into the WebAssembly module without awaiting the instantiation that starts when Spark is imported, so a call made before instantiation finished threw TypeError: Cannot read properties of undefined (reading 'packedsplats_to_gsplatarray'). Awaiting instantiation makes writeSpz async, so both overloads return a promise and every caller has to await the result, a break in the signature added in 2.2.0.

transcodeSpz added an equivalent await in #438.

Writing SPZ never waited for the WebAssembly module, so a call made
before loading finished threw a type error. Writing now waits for the
module and returns a promise callers must await.
@oscarlorentzon

Copy link
Copy Markdown
Collaborator Author

As mentioned above, this breaks the writeSpz API introduced in #374. 2.2.0 is the only release with the synchronous signature, and that signature works for any call made after the WebAssembly module has instantiated.

Is it acceptable to break compatibility here if we treat the change as fixing a defect?

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