Skip to content

fix(SingleThreadedFragmentsModel)!: expose raw arg defaulting to false#209

Open
ShaMan123 wants to merge 1 commit into
ThatOpen:mainfrom
ShaMan123:fix/save-options
Open

fix(SingleThreadedFragmentsModel)!: expose raw arg defaulting to false#209
ShaMan123 wants to merge 1 commit into
ThatOpen:mainfrom
ShaMan123:fix/save-options

Conversation

@ShaMan123
Copy link
Copy Markdown
Contributor

@ShaMan123 ShaMan123 commented May 14, 2026

Description

SingleThreadedFragmentsModel#save and SingleThreadedFragmentsModel#edit returned a raw buffer. This does not align with the rest of the API, which defaults to false.
I have exposed raw as a last arg defaulting to false.
Should we add a comment that runtime editing should use raw in order to avoid deflating/inflating for performance reasons?

fixes #186 (comment)

Additional context

Before this fix

const model = new SingleThreadedFragmentsModel("my-model", buffer);
const newBuf = model.save();
new SingleThreadedFragmentsModel("my-model", newBuf); // fails
new SingleThreadedFragmentsModel("my-model", newBuf, true); // succeeds

After this fix

const model = new SingleThreadedFragmentsModel("my-model", buffer);
const newBuf = model.save();
new SingleThreadedFragmentsModel("my-model", newBuf);
const newRawBuf = model.save(true);
new SingleThreadedFragmentsModel("my-model", newBuf, true);

What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

Before submitting the PR, please make sure you do the following:

  • Check that there isn't already a PR that solves the problem the same way to avoid creating a duplicate.
  • Follow the Conventional Commits v1.0.0 standard for PR naming (e.g. feat(examples): add hello-world example).
  • Provide a description in this PR that addresses what the PR is solving, or reference the issue that it solves (e.g. fixes #123).
  • Ideally, include relevant tests that fail without this PR but pass with it.

Copy link
Copy Markdown
Contributor Author

@ShaMan123 ShaMan123 left a comment

Choose a reason for hiding this comment

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

done

@ShaMan123
Copy link
Copy Markdown
Contributor Author

updated description

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.

Edit API for SingleThreadedFragmentsModel

1 participant