Migration Guide for v1.5.0
With this update, there are some breaking changes regarding how edit works with partial diffs (fileDiff.isPartial === true);
-
Diffs will now throw errors if you attempt to edit a diff that isPartial and has not been supplied any
loadDiffFilesprop. Before it would fail silently. This applies to all editable components. -
For standalone vanilla JS, wait before attaching the editor. Keep your existing render call, then change the edit call to:
renderFromApplicationState(); let finishEditing; try { if (fileDiffInstance.fileDiff?.isPartial === true) { await fileDiffInstance.prepareForEditing(); } finishEditing = editor.edit(fileDiffInstance); } catch (error) { showEditError(error); // Use your app's error UI. }Check the instance's current
fileDiff.isPartialvalue so complete diffs attach synchronously. Preparation rejects if it cannot be loaded. -
If React or
CodeViewedits a partial diff, wait for attachment before using the editor. The full files load first. Put editor-dependent work inonAttach;CodeView.getEditor(itemId)returnsundefineduntil then. MissingloadDiffFilesthrows when the partial edit item renders.
What's Changed
- [diffs] Harden filename parsing in the patch parsing paths by @amadeus in https://github.com/pierrecomputer/pierre/pull/1143
- fix(diffs): preserve parsed blank-line change positions by @amadeus in https://github.com/pierrecomputer/pierre/pull/1142
- [diffs] CodeView: Fix annotation anchoring bugs at the bottom of the viewport by @amadeus in https://github.com/pierrecomputer/pierre/pull/1149
- [diffs] Compare diffs by cache key when finalizing a virtualized render by @jonatanklosko in https://github.com/pierrecomputer/pierre/pull/1151
- [diffs] CodeView / Edit Improvements by @amadeus in https://github.com/pierrecomputer/pierre/pull/1152
Full Changelog: https://github.com/pierrecomputer/pierre/compare/diffs-v1.4.3...diffs-v1.5.0