@d3lm/pr-stats 0.2.17 → 0.2.19

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/README.md CHANGED
@@ -116,7 +116,7 @@ The `r` key reloads the data by hand, and `R` refetches everything past the cach
116
116
 
117
117
  ## Notifications
118
118
 
119
- The Desktop notifications row in the settings dialog makes the TUI send a desktop notification whenever a load finds a PR newly awaiting your review or a review re-requested from you after you already reviewed the PR. Every load diffs its review requests against the load before it, so the first load of a session only records what is already waiting and never notifies about it. Manual reloads count as well, but the feature pairs naturally with auto reload, which lets the TUI watch your review queue from a spare terminal. The setting persists in `settings.json` in the cache directory.
119
+ The Desktop notifications row in the settings dialog makes the TUI send a desktop notification whenever a load finds a PR newly awaiting your review or a review re-requested from you after you already reviewed the PR. Every load diffs its review requests against the data shown before it. For the first load of a session that is the startup snapshot from the previous session, so a restart tells you what came in while the TUI was closed. Only a session without a snapshot, after `--no-cache` or on the first run, starts by recording what is already waiting without notifying about it. Manual reloads count as well, but the feature pairs naturally with auto reload, which lets the TUI watch your review queue from a spare terminal. The setting persists in `settings.json` in the cache directory.
120
120
 
121
121
  ```json
122
122
  {
@@ -19,9 +19,9 @@
19
19
  <key>CFBundlePackageType</key>
20
20
  <string>APPL</string>
21
21
  <key>CFBundleShortVersionString</key>
22
- <string>0.2.17</string>
22
+ <string>0.2.19</string>
23
23
  <key>CFBundleVersion</key>
24
- <string>0.2.17</string>
24
+ <string>0.2.19</string>
25
25
  <key>LSMinimumSystemVersion</key>
26
26
  <string>13.0</string>
27
27
  <key>LSUIElement</key>
package/dist/tui-app.mjs CHANGED
@@ -3377,6 +3377,9 @@ async function searchPrsViaApi({ user, sinceIso, repos, includeDrafts, mode }) {
3377
3377
  authored: "author"
3378
3378
  }[mode];
3379
3379
  const terms = ["type:pr", `${qualifier}:${user}`, `created:>=${sinceIso}`];
3380
+ if (mode !== "authored") {
3381
+ terms.push(`-author:${user}`);
3382
+ }
3380
3383
  if (!includeDrafts) {
3381
3384
  terms.push("draft:false");
3382
3385
  }
@@ -3433,6 +3436,9 @@ async function searchPrs({ user, sinceIso, repos, includeDrafts, mode }) {
3433
3436
  for (const repo of repos) {
3434
3437
  args.push("--repo", repo);
3435
3438
  }
3439
+ if (mode !== "authored") {
3440
+ args.push("--", `-author:${user}`);
3441
+ }
3436
3442
  return JSON.parse(await gh(args));
3437
3443
  }
3438
3444
  async function fetchPrDetails(prs) {
@@ -4670,7 +4676,8 @@ function useDeferredLoading(isLoading, { showDelay = 300, minDuration = 500 } =
4670
4676
 
4671
4677
  // src/tui/hooks/useLoader.ts
4672
4678
  import { useEffect as useEffect6, useRef as useRef4, useState as useState3 } from "react";
4673
- function useLoader(options, noCache2, onLoaded) {
4679
+ function useLoader(options, noCache2, callbacks = {}) {
4680
+ const { onSnapshot, onLoaded } = callbacks;
4674
4681
  const [startupSnapshot] = useState3(() => noCache2 ? null : loadSnapshot(options));
4675
4682
  const [raw, setRaw] = useState3(startupSnapshot);
4676
4683
  const [appliedKey, setAppliedKey] = useState3(
@@ -4723,6 +4730,9 @@ function useLoader(options, noCache2, onLoaded) {
4723
4730
  disposedRef.current = false;
4724
4731
  if (!startedRef.current) {
4725
4732
  startedRef.current = true;
4733
+ if (startupSnapshot !== null) {
4734
+ onSnapshot?.(startupSnapshot);
4735
+ }
4726
4736
  void run(noCache2);
4727
4737
  }
4728
4738
  return () => {
@@ -7029,19 +7039,24 @@ function App({
7029
7039
  const notifyReviewChanges = useReviewNotifications(notifications2, notifier, (message) => {
7030
7040
  dispatchUi({ type: "openErrorReported", message });
7031
7041
  });
7032
- const { raw, isSnapshot, loading, load, error, stale, reload } = useLoader(options, noCache2, (data) => {
7033
- dispatchBrowse({
7034
- type: "dataLoaded",
7035
- repos: {
7036
- pending: buildPendingRepoOptions(data),
7037
- open: buildOpenRepoOptions(data),
7038
- review: buildReviewRepoOptions(data),
7039
- size: buildSizeRepoOptions(data),
7040
- comment: buildCommentRepoOptions(data),
7041
- merged: buildMergedRepoOptions(data)
7042
- }
7043
- });
7044
- notifyReviewChanges(fetchParamsKey(options), data.reviewResults);
7042
+ const { raw, isSnapshot, loading, load, error, stale, reload } = useLoader(options, noCache2, {
7043
+ onSnapshot: (data) => {
7044
+ notifyReviewChanges(fetchParamsKey(options), data.reviewResults);
7045
+ },
7046
+ onLoaded: (data) => {
7047
+ dispatchBrowse({
7048
+ type: "dataLoaded",
7049
+ repos: {
7050
+ pending: buildPendingRepoOptions(data),
7051
+ open: buildOpenRepoOptions(data),
7052
+ review: buildReviewRepoOptions(data),
7053
+ size: buildSizeRepoOptions(data),
7054
+ comment: buildCommentRepoOptions(data),
7055
+ merged: buildMergedRepoOptions(data)
7056
+ }
7057
+ });
7058
+ notifyReviewChanges(fetchParamsKey(options), data.reviewResults);
7059
+ }
7045
7060
  });
7046
7061
  useAutoReload(autoReload2 ? reloadIntervalMs(reloadInterval2) : null, loading, reload);
7047
7062
  const views = useViewModel(raw, options, width, browse.scopes, browse.grouped, browse.expanded, themeState);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@d3lm/pr-stats",
3
- "version": "0.2.17",
3
+ "version": "0.2.19",
4
4
  "description": "GitHub PR stats in an interactive terminal UI, via the gh CLI or an access token",
5
5
  "type": "module",
6
6
  "author": "Dominic Elm",