@gogitcms/editor 0.23.0 → 0.25.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/app/src/App.tsx CHANGED
@@ -2373,10 +2373,10 @@ function useBranchImport(repositoryId?: string, branchId?: string) {
2373
2373
  const [live, setLive] = useState<BranchImportState | null>(null);
2374
2374
  // Tracks the previous render's `running`, to spot the moment an import lands.
2375
2375
  const wasRunning = useRef(false);
2376
- // A branch switch invalidates the previous branch's live state; without this
2377
- // the new branch would inherit it until the new subscription's first emission.
2378
- // Declared before the landing effect below so it resets first, and the new
2379
- // branch is never credited with the old one's in-flight import.
2376
+ // A branch switch invalidates the previous branch's live state. The `branchId`
2377
+ // check below is what actually makes that safe this only frees the memory —
2378
+ // because an effect runs a render too late to keep the switching render from
2379
+ // reading it.
2380
2380
  useEffect(() => { setLive(null); wasRunning.current = false; }, [repositoryId, branchId]);
2381
2381
  useSubscription(BRANCH_IMPORT_PROGRESS, {
2382
2382
  variables,
@@ -2390,16 +2390,40 @@ function useBranchImport(repositoryId?: string, branchId?: string) {
2390
2390
  },
2391
2391
  });
2392
2392
 
2393
- const state: BranchImportState | null = live ?? data?.branchImport ?? null;
2394
-
2395
- // An import that just landed replaced the content behind every open query, so
2396
- // re-read them. When this fires for a FIRST import the editor is not mounted
2397
- // yet and the only active query is the repository list which is exactly the
2398
- // one that has to be re-read, since the branch's projects arrive with the
2399
- // import.
2393
+ // Every answer names the branch it describes, and anything naming a different
2394
+ // one is discarded. Both sources outlive the render that switches branches —
2395
+ // `live` until its reset effect runs, `data` for as long as Apollo holds the
2396
+ // previous variables' result so without this the switching render answers
2397
+ // for the branch just left. That is not a cosmetic flash: on the way onto a
2398
+ // newly created branch it reports "already imported", the gate opens, and the
2399
+ // editor mounts and caches an empty `collections` for a branch whose import
2400
+ // has not run yet — an empty editor that never fills in.
2401
+ const answer = live ?? data?.branchImport ?? null;
2402
+ const state: BranchImportState | null =
2403
+ answer && answer.branchId === branchId ? answer : null;
2404
+
2405
+ // An import that just landed replaced this branch's content, so drop what the
2406
+ // cache believes about it and re-read the lists.
2407
+ //
2408
+ // Eviction is not redundant with the refetch: `refetchQueries` only reaches
2409
+ // MOUNTED queries, and the editor is unmounted behind the first-import gate.
2410
+ // Without it, a `collections` answer cached before the import landed would
2411
+ // still be there when the gate opens and the editor mounts.
2412
+ //
2413
+ // Open documents are deliberately left out of both. Replacing the text under
2414
+ // an editor that may hold unsaved edits is worse than showing content one
2415
+ // import behind, and the import's own notification already says something
2416
+ // changed.
2400
2417
  useEffect(() => {
2401
2418
  if (!state) return;
2402
- if (wasRunning.current && !state.running) void apollo.refetchQueries({ include: "active" });
2419
+ if (wasRunning.current && !state.running) {
2420
+ for (const fieldName of ["collections", "documents", "documentCount", "mediaSets", "media", "mediaCount", "mediaFacets"]) {
2421
+ apollo.cache.evict({ id: "ROOT_QUERY", fieldName });
2422
+ }
2423
+ apollo.cache.gc();
2424
+ // REPOSITORIES carries the branch's projects, which arrive with the import.
2425
+ void apollo.refetchQueries({ include: [REPOSITORIES, COLLECTIONS, DOCUMENTS, DOCUMENT_COUNT] });
2426
+ }
2403
2427
  wasRunning.current = state.running;
2404
2428
  }, [state?.running, apollo]);
2405
2429
 
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@gogitcms/editor",
3
- "version": "0.23.0",
3
+ "version": "0.25.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@gogitcms/editor",
9
- "version": "0.23.0",
9
+ "version": "0.25.0",
10
10
  "dependencies": {
11
11
  "@apollo/client": "^3.11.8",
12
12
  "@handlewithcare/react-prosemirror": "^3.2.7",
@@ -47,11 +47,11 @@
47
47
  "node": ">=20"
48
48
  },
49
49
  "optionalDependencies": {
50
- "@gogitcms/gitcms-local-darwin-arm64": "0.23.0",
51
- "@gogitcms/gitcms-local-darwin-x64": "0.23.0",
52
- "@gogitcms/gitcms-local-linux-arm64": "0.23.0",
53
- "@gogitcms/gitcms-local-linux-x64": "0.23.0",
54
- "@gogitcms/gitcms-local-win32-x64": "0.23.0"
50
+ "@gogitcms/gitcms-local-darwin-arm64": "0.25.0",
51
+ "@gogitcms/gitcms-local-darwin-x64": "0.25.0",
52
+ "@gogitcms/gitcms-local-linux-arm64": "0.25.0",
53
+ "@gogitcms/gitcms-local-linux-x64": "0.25.0",
54
+ "@gogitcms/gitcms-local-win32-x64": "0.25.0"
55
55
  }
56
56
  },
57
57
  "node_modules/@apollo/client": {
@@ -751,9 +751,9 @@
751
751
  }
752
752
  },
753
753
  "node_modules/@gogitcms/gitcms-local-darwin-arm64": {
754
- "version": "0.23.0",
755
- "resolved": "https://registry.npmjs.org/@gogitcms/gitcms-local-darwin-arm64/-/gitcms-local-darwin-arm64-0.23.0.tgz",
756
- "integrity": "sha512-kfPtnEYLi0y9dius3PnQoqbFTqBn3pINjhBfub67VpGDWJ88ZQw57AEgAPXRM21thUAmiFAHLkOwOTnnktIufQ==",
754
+ "version": "0.25.0",
755
+ "resolved": "https://registry.npmjs.org/@gogitcms/gitcms-local-darwin-arm64/-/gitcms-local-darwin-arm64-0.25.0.tgz",
756
+ "integrity": "sha512-sJd3OWLscUPtIedhokAEDY1BMk207MZyhQvbUmSKzyjlorRNUduC7P7VkzeUVbdIaA1zmw1fPvq/y3Mhy5p9Cg==",
757
757
  "cpu": [
758
758
  "arm64"
759
759
  ],
@@ -764,9 +764,9 @@
764
764
  ]
765
765
  },
766
766
  "node_modules/@gogitcms/gitcms-local-darwin-x64": {
767
- "version": "0.23.0",
768
- "resolved": "https://registry.npmjs.org/@gogitcms/gitcms-local-darwin-x64/-/gitcms-local-darwin-x64-0.23.0.tgz",
769
- "integrity": "sha512-CJbVB1uUUcapWGj3XdX5qYwKnmuGcMhKrlN65SiX46lGjeKBfs6RJgvV0LspkJDsrqZ+DlLEtt52i1oPoGBfrQ==",
767
+ "version": "0.25.0",
768
+ "resolved": "https://registry.npmjs.org/@gogitcms/gitcms-local-darwin-x64/-/gitcms-local-darwin-x64-0.25.0.tgz",
769
+ "integrity": "sha512-vp1I30oLLxBX5KZaxZqTZofU8vCZwipOuhrU8tvfa92cdHFPHWJGGSP7JV2IXjEK/3/oEZrhnk0saQSiKwf80A==",
770
770
  "cpu": [
771
771
  "x64"
772
772
  ],
@@ -777,9 +777,9 @@
777
777
  ]
778
778
  },
779
779
  "node_modules/@gogitcms/gitcms-local-linux-arm64": {
780
- "version": "0.23.0",
781
- "resolved": "https://registry.npmjs.org/@gogitcms/gitcms-local-linux-arm64/-/gitcms-local-linux-arm64-0.23.0.tgz",
782
- "integrity": "sha512-Rd7Y0drASw0mHXVDvnaQHgQAnkwKYh/LGLwSYXjq7v5qVnaZDM+Q7PYBMk0yqKPN2jatPl8BQQIV6fJfHXYMCA==",
780
+ "version": "0.25.0",
781
+ "resolved": "https://registry.npmjs.org/@gogitcms/gitcms-local-linux-arm64/-/gitcms-local-linux-arm64-0.25.0.tgz",
782
+ "integrity": "sha512-iPfPLzV2NmvxBqQYwA5NsiPIWO3R3DKOItDMGWTRsV9hlEkPYK8R4c7A2iK/A5QiAkpR4bceeI5QnuwQFJFpdg==",
783
783
  "cpu": [
784
784
  "arm64"
785
785
  ],
@@ -790,9 +790,9 @@
790
790
  ]
791
791
  },
792
792
  "node_modules/@gogitcms/gitcms-local-linux-x64": {
793
- "version": "0.23.0",
794
- "resolved": "https://registry.npmjs.org/@gogitcms/gitcms-local-linux-x64/-/gitcms-local-linux-x64-0.23.0.tgz",
795
- "integrity": "sha512-zaabkKoyZ/KCVoSv/CnuCRdtOZELhRuhE4LJqxG1Qc2JEYF5RrB/3yWDW1+89SO8AxSM5iD0xMZ16+SgBfqQLg==",
793
+ "version": "0.25.0",
794
+ "resolved": "https://registry.npmjs.org/@gogitcms/gitcms-local-linux-x64/-/gitcms-local-linux-x64-0.25.0.tgz",
795
+ "integrity": "sha512-stUOczAEnyItQqMnG+RaUkPYNCKqIdK3N6rG3grUDdXkNaS/tPXDc/ehEjKY2+c0o3NRIFpHrDVVh/lHazoRTw==",
796
796
  "cpu": [
797
797
  "x64"
798
798
  ],
@@ -803,9 +803,9 @@
803
803
  ]
804
804
  },
805
805
  "node_modules/@gogitcms/gitcms-local-win32-x64": {
806
- "version": "0.23.0",
807
- "resolved": "https://registry.npmjs.org/@gogitcms/gitcms-local-win32-x64/-/gitcms-local-win32-x64-0.23.0.tgz",
808
- "integrity": "sha512-6WRhc0BBs07W2GFMeLeCJVvNy3vPE4hLfPtL5w8mbrcIGr/rkOtfY4NVG5I3REZhAaX2v0oNYOWtewcu7wVePQ==",
806
+ "version": "0.25.0",
807
+ "resolved": "https://registry.npmjs.org/@gogitcms/gitcms-local-win32-x64/-/gitcms-local-win32-x64-0.25.0.tgz",
808
+ "integrity": "sha512-rUhJZgXT2r4Z6Vfl3zzJUe6jXOrt0UC6X7yC/qCk5gfJlR9yJHDa9etO6pURn07fV6RcaKB9VeuN7ijz5vYYuA==",
809
809
  "cpu": [
810
810
  "x64"
811
811
  ],
@@ -982,12 +982,12 @@
982
982
  }
983
983
  },
984
984
  "node_modules/@posthog/core": {
985
- "version": "1.48.11",
986
- "resolved": "https://registry.npmjs.org/@posthog/core/-/core-1.48.11.tgz",
987
- "integrity": "sha512-fvKbxGaUM8RuCDB1jdhSqAHYjk42INfJDWT1KVezn74sCrfnr1YaUafxzmcS+87D5FzbA2tu7IT0GQRV2WkkRg==",
985
+ "version": "1.49.0",
986
+ "resolved": "https://registry.npmjs.org/@posthog/core/-/core-1.49.0.tgz",
987
+ "integrity": "sha512-+Ejf6sZ2wI9F37rOrPxoI90mydOw5O/YKjAgWMkkuuQRHGwyfXugxsD/+CVI4Yymg8LujHr0C/KXJvWDJYgwWQ==",
988
988
  "license": "MIT",
989
989
  "dependencies": {
990
- "@posthog/types": "^1.405.3"
990
+ "@posthog/types": "^1.407.0"
991
991
  }
992
992
  },
993
993
  "node_modules/@posthog/types": {
@@ -3898,9 +3898,9 @@
3898
3898
  "peer": true
3899
3899
  },
3900
3900
  "node_modules/node-releases": {
3901
- "version": "2.0.53",
3902
- "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.53.tgz",
3903
- "integrity": "sha512-D9UOmYG3UH1V+ENW56t5QXBwJw1YEY18ruVeus89Rw+SyIgjPkCO84bRzO3uNIYosJbNwiabWVn48o3uJLjxFQ==",
3901
+ "version": "2.0.54",
3902
+ "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.54.tgz",
3903
+ "integrity": "sha512-YHs7BmmcsdAI5Ozuf8JZo6PT0mv2GIWC9vMfvUC3dp65M8hn7Ux8CPL+2oBI7juNuj9d0ndhTcznq2ODBps9cQ==",
3904
3904
  "license": "MIT",
3905
3905
  "engines": {
3906
3906
  "node": ">=18"
@@ -4071,13 +4071,13 @@
4071
4071
  "license": "MIT"
4072
4072
  },
4073
4073
  "node_modules/posthog-js": {
4074
- "version": "1.421.0",
4075
- "resolved": "https://registry.npmjs.org/posthog-js/-/posthog-js-1.421.0.tgz",
4076
- "integrity": "sha512-MXXVvAphK7rXg8bPGTBHWG/I5784wMyRev6sjjQPRXLoMy3JJcvaZuBHrlLqNLCw8r6YtD12ubNBo/2ZdaElIQ==",
4074
+ "version": "1.422.0",
4075
+ "resolved": "https://registry.npmjs.org/posthog-js/-/posthog-js-1.422.0.tgz",
4076
+ "integrity": "sha512-m2mg6SLFZs9L2/L+a8+aeraR0LyijMrXLuwSbgfSeBLjHe99C4IR11Q2DV7R5qktVTwSx0Dg2kdMosx35/FfwQ==",
4077
4077
  "license": "(Apache-2.0 AND MIT)",
4078
4078
  "dependencies": {
4079
4079
  "@posthog/browser-common": "^0.6.0",
4080
- "@posthog/core": "^1.48.11",
4080
+ "@posthog/core": "^1.49.0",
4081
4081
  "@posthog/types": "^1.407.0",
4082
4082
  "core-js": "^3.49.0",
4083
4083
  "dompurify": "^3.4.13",
@@ -5056,9 +5056,9 @@
5056
5056
  }
5057
5057
  },
5058
5058
  "node_modules/terser": {
5059
- "version": "5.51.0",
5060
- "resolved": "https://registry.npmjs.org/terser/-/terser-5.51.0.tgz",
5061
- "integrity": "sha512-myiQ6aFnxDOjdiXdTlC8ngVccQD88uHXTx5RUQOSEnarDYgJMjDagwAQszcOusjvmf4YqWsxoD1+MY+oAJRmpw==",
5059
+ "version": "5.51.2",
5060
+ "resolved": "https://registry.npmjs.org/terser/-/terser-5.51.2.tgz",
5061
+ "integrity": "sha512-bWnjSNscmuI+GJze6ZupnHP8G/cTcsJF+bXCeQknk2SHQsgbNJnLrqiH9jZ2W4STPVXH2mDKKRX3iwPhc9Cn/Q==",
5062
5062
  "license": "BSD-2-Clause",
5063
5063
  "peer": true,
5064
5064
  "dependencies": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gogitcms/editor",
3
- "version": "0.23.0",
3
+ "version": "0.25.0",
4
4
  "description": "Terminal UI for setting up and running the Go·Git CMS content editor",
5
5
  "type": "module",
6
6
  "bin": {
@@ -65,10 +65,10 @@
65
65
  "@gogitcms/frontend": "workspace:*"
66
66
  },
67
67
  "optionalDependencies": {
68
- "@gogitcms/gitcms-local-darwin-arm64": "0.23.0",
69
- "@gogitcms/gitcms-local-darwin-x64": "0.23.0",
70
- "@gogitcms/gitcms-local-linux-arm64": "0.23.0",
71
- "@gogitcms/gitcms-local-linux-x64": "0.23.0",
72
- "@gogitcms/gitcms-local-win32-x64": "0.23.0"
68
+ "@gogitcms/gitcms-local-darwin-arm64": "0.25.0",
69
+ "@gogitcms/gitcms-local-darwin-x64": "0.25.0",
70
+ "@gogitcms/gitcms-local-linux-arm64": "0.25.0",
71
+ "@gogitcms/gitcms-local-linux-x64": "0.25.0",
72
+ "@gogitcms/gitcms-local-win32-x64": "0.25.0"
73
73
  }
74
74
  }