@d3lm/pr-stats 0.2.17 → 0.2.18

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.18</string>
23
23
  <key>CFBundleVersion</key>
24
- <string>0.2.17</string>
24
+ <string>0.2.18</string>
25
25
  <key>LSMinimumSystemVersion</key>
26
26
  <string>13.0</string>
27
27
  <key>LSUIElement</key>
package/dist/tui-app.mjs CHANGED
@@ -4670,7 +4670,8 @@ function useDeferredLoading(isLoading, { showDelay = 300, minDuration = 500 } =
4670
4670
 
4671
4671
  // src/tui/hooks/useLoader.ts
4672
4672
  import { useEffect as useEffect6, useRef as useRef4, useState as useState3 } from "react";
4673
- function useLoader(options, noCache2, onLoaded) {
4673
+ function useLoader(options, noCache2, callbacks = {}) {
4674
+ const { onSnapshot, onLoaded } = callbacks;
4674
4675
  const [startupSnapshot] = useState3(() => noCache2 ? null : loadSnapshot(options));
4675
4676
  const [raw, setRaw] = useState3(startupSnapshot);
4676
4677
  const [appliedKey, setAppliedKey] = useState3(
@@ -4723,6 +4724,9 @@ function useLoader(options, noCache2, onLoaded) {
4723
4724
  disposedRef.current = false;
4724
4725
  if (!startedRef.current) {
4725
4726
  startedRef.current = true;
4727
+ if (startupSnapshot !== null) {
4728
+ onSnapshot?.(startupSnapshot);
4729
+ }
4726
4730
  void run(noCache2);
4727
4731
  }
4728
4732
  return () => {
@@ -7029,19 +7033,24 @@ function App({
7029
7033
  const notifyReviewChanges = useReviewNotifications(notifications2, notifier, (message) => {
7030
7034
  dispatchUi({ type: "openErrorReported", message });
7031
7035
  });
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);
7036
+ const { raw, isSnapshot, loading, load, error, stale, reload } = useLoader(options, noCache2, {
7037
+ onSnapshot: (data) => {
7038
+ notifyReviewChanges(fetchParamsKey(options), data.reviewResults);
7039
+ },
7040
+ onLoaded: (data) => {
7041
+ dispatchBrowse({
7042
+ type: "dataLoaded",
7043
+ repos: {
7044
+ pending: buildPendingRepoOptions(data),
7045
+ open: buildOpenRepoOptions(data),
7046
+ review: buildReviewRepoOptions(data),
7047
+ size: buildSizeRepoOptions(data),
7048
+ comment: buildCommentRepoOptions(data),
7049
+ merged: buildMergedRepoOptions(data)
7050
+ }
7051
+ });
7052
+ notifyReviewChanges(fetchParamsKey(options), data.reviewResults);
7053
+ }
7045
7054
  });
7046
7055
  useAutoReload(autoReload2 ? reloadIntervalMs(reloadInterval2) : null, loading, reload);
7047
7056
  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.18",
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",