mirror of
https://github.com/discourse/discourse.git
synced 2024-11-27 03:10:46 -06:00
80b9c280ba
This will bring significant improvements to install speed & storage requirements. For information on how it may affect you, see https://meta.discourse.org/t/324521 This commit: - removes the `yarn.lock` and replaces with `pnpm-lock.yaml` - updates workspaces to pnpm format - adjusts package dependencies to work with pnpm's stricter resolution strategy - updates Rails app to load modules from more specific node_modules directories - adds a `.pnpmfile` which automatically cleans up old yarn-managed `node_modules` directories - updates various scripts to call `pnpm` instead of `yarn` - updates patches to use pnpm's native patch system instead of patch-package - adds a patch for licensee to support pnpm
44 lines
1.4 KiB
Diff
44 lines
1.4 KiB
Diff
diff --git a/vtree/diff.js b/vtree/diff.js
|
|
index b5bccbd..058d6b3 100644
|
|
--- a/vtree/diff.js
|
|
+++ b/vtree/diff.js
|
|
@@ -311,6 +311,38 @@ function reorder(aChildren, bChildren) {
|
|
var inserts = []
|
|
var simulateItem
|
|
|
|
+ // handle prepends without reordering old elements
|
|
+ var shift = bChildren.length - aChildren.length
|
|
+ if (shift > 0 && simulate.length === bChildren.length) {
|
|
+ var prepend = true
|
|
+ for (var i = 0; prepend && i < simulate.length; i++) {
|
|
+ prepend = simulate[i] && simulate[i].key
|
|
+ }
|
|
+ for (var i = 0; prepend && i < aChildren.length; i++) {
|
|
+ prepend = aChildren[i].key === bChildren[i + shift].key
|
|
+ }
|
|
+
|
|
+ if (prepend) {
|
|
+ for (var i = 0; i < shift; i++) {
|
|
+ removes.push({
|
|
+ from: aChildren.length,
|
|
+ key: bChildren[i].key
|
|
+ })
|
|
+ inserts.push({
|
|
+ to: i,
|
|
+ key: bChildren[i].key
|
|
+ })
|
|
+ }
|
|
+ return {
|
|
+ children: newChildren,
|
|
+ moves: {
|
|
+ removes: removes,
|
|
+ inserts: inserts
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+
|
|
for (var k = 0; k < bChildren.length;) {
|
|
var wantedItem = bChildren[k]
|
|
simulateItem = simulate[simulateIndex]
|