github pierrecomputer/pierre diffs-v1.5.0

3 hours ago

Migration Guide for v1.5.0

With this update, there are some breaking changes regarding how edit works with partial diffs (fileDiff.isPartial === true);

  1. Diffs will now throw errors if you attempt to edit a diff that isPartial and has not been supplied any loadDiffFiles prop. Before it would fail silently. This applies to all editable components.

  2. 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.isPartial value so complete diffs attach synchronously. Preparation rejects if it cannot be loaded.

  3. If React or CodeView edits a partial diff, wait for attachment before using the editor. The full files load first. Put editor-dependent work in onAttach; CodeView.getEditor(itemId) returns undefined until then. Missing loadDiffFiles throws when the partial edit item renders.

What's Changed

  • [diffs] Harden filename parsing in the patch parsing paths by @amadeus in #1143
  • fix(diffs): preserve parsed blank-line change positions by @amadeus in #1142
  • [diffs] CodeView: Fix annotation anchoring bugs at the bottom of the viewport by @amadeus in #1149
  • [diffs] Compare diffs by cache key when finalizing a virtualized render by @jonatanklosko in #1151
  • [diffs] CodeView / Edit Improvements by @amadeus in #1152

Full Changelog: diffs-v1.4.3...diffs-v1.5.0

Don't miss a new pierre release

NewReleases is sending notifications on new releases.