@sensiblestats/widget-react 0.60.1 → 0.60.2

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/dist/index.js CHANGED
@@ -2174,6 +2174,7 @@ function useLeaderboard(conversation, { activeTab }) {
2174
2174
  void doFetch();
2175
2175
  return () => {
2176
2176
  active = false;
2177
+ inFlightRef.current = false;
2177
2178
  };
2178
2179
  }, [activeTab, refreshCount]);
2179
2180
  const refresh = useCallback5(() => {
@@ -6781,6 +6782,7 @@ function safeParseConfig(json) {
6781
6782
  function GameScreenHost({
6782
6783
  selected,
6783
6784
  onBack,
6785
+ onPlayed,
6784
6786
  conversation,
6785
6787
  ui
6786
6788
  }) {
@@ -6824,7 +6826,11 @@ function GameScreenHost({
6824
6826
  const sharedProps = {
6825
6827
  result,
6826
6828
  submitting,
6827
- onSubmit: submit,
6829
+ // Refresh only after the play is saved: a fan can tap Back while a submit is still in flight,
6830
+ // and a refetch fired from Back alone would read the hub's pre-play state.
6831
+ onSubmit: (answerJson) => {
6832
+ void submit(answerJson).then(() => onPlayed?.());
6833
+ },
6828
6834
  ui,
6829
6835
  onBack,
6830
6836
  lockAtUtc
@@ -6941,7 +6947,8 @@ function GamesPanel({
6941
6947
  games,
6942
6948
  ui,
6943
6949
  conversation,
6944
- leaderboard
6950
+ leaderboard,
6951
+ refreshHub
6945
6952
  }) {
6946
6953
  const [selected, setSelected] = useState35(null);
6947
6954
  useEffect16(() => {
@@ -6953,7 +6960,11 @@ function GamesPanel({
6953
6960
  GameScreenHost,
6954
6961
  {
6955
6962
  selected,
6956
- onBack: () => setSelected(null),
6963
+ onBack: () => {
6964
+ setSelected(null);
6965
+ refreshHub?.();
6966
+ },
6967
+ onPlayed: refreshHub,
6957
6968
  conversation: conversation ?? null,
6958
6969
  ui
6959
6970
  }
@@ -7203,7 +7214,20 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, g
7203
7214
  monitor && discovery && monitor.activeTab === "today" && /* @__PURE__ */ jsx85(TodayPanel, { discovery, ui, monitor }),
7204
7215
  monitor && monitor.activeTab === "following" && /* @__PURE__ */ jsx85(MatchesPanel, { monitor, ui, slip }),
7205
7216
  monitor && monitor.activeTab === "odds" && /* @__PURE__ */ jsx85(OddsPanel, { monitor, ui, slip }),
7206
- monitor && monitor.activeTab === "games" && gamesResult && /* @__PURE__ */ jsx85(GamesPanel, { loggedIn: !!loggedIn, games: gamesResult.games, ui, conversation, leaderboard: leaderboardResult?.data ?? null }),
7217
+ monitor && monitor.activeTab === "games" && gamesResult && /* @__PURE__ */ jsx85(
7218
+ GamesPanel,
7219
+ {
7220
+ loggedIn: !!loggedIn,
7221
+ games: gamesResult.games,
7222
+ ui,
7223
+ conversation,
7224
+ leaderboard: leaderboardResult?.data ?? null,
7225
+ refreshHub: () => {
7226
+ gamesResult.refresh();
7227
+ leaderboardResult?.refresh();
7228
+ }
7229
+ }
7230
+ ),
7207
7231
  monitor && monitor.activeTab === "leaderboard" && leaderboardResult && /* @__PURE__ */ jsx85(
7208
7232
  LeaderboardPanel,
7209
7233
  {