Skip to content

Commit 18b7f12

Browse files
Jen-Unoclaude
andcommitted
refactor(fit-app): address second code-quality pass on #930
- WeeklyRing.UpdateArc: assign the new PathGeometry directly to ArcPath.Data instead of via a throwaway local (the Path owns it; the previous geometry is still disposed before replacement) — clears the "IDisposable not disposed" flag. - Shell.StartupLoadable.Begin: drop the defensive generic catch around Task.Delay. A constant delay with no cancellation token cannot throw; the splash-dismissal guarantee is the TryEnqueue/Complete fallback, which stays. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 4d37d41 commit 18b7f12

2 files changed

Lines changed: 7 additions & 15 deletions

File tree

studio/fit-app/FitBeginnerApp/Presentation/Shell.xaml.cs

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,17 +39,10 @@ private sealed class StartupLoadable : ILoadable
3939

4040
public async void Begin(DispatcherQueue dispatcher, TimeSpan delay)
4141
{
42-
try
43-
{
44-
await Task.Delay(delay);
45-
}
46-
catch
47-
{
48-
// Swallow: the splash must still be dismissed below.
49-
}
42+
await Task.Delay(delay);
5043

51-
// Prefer the UI thread; if enqueue fails (dispatcher shutting down), complete inline
52-
// so IsExecuting is never left stuck true.
44+
// Prefer the UI thread; if enqueue fails (dispatcher shutting down), complete inline so
45+
// IsExecuting is never left stuck true — this is what guarantees the splash is dismissed.
5346
if (!dispatcher.TryEnqueue(Complete))
5447
{
5548
Complete();

studio/fit-app/FitBeginnerApp/Presentation/WeeklyRing.xaml.cs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -161,12 +161,11 @@ private void UpdateArc()
161161
IsLargeArc = sweep > 180,
162162
});
163163

164-
var geometry = new PathGeometry();
165-
geometry.Figures.Add(figure);
166-
// Dispose the geometry from the previous update before it is replaced (UpdateArc runs on
167-
// every progress tick during the entrance animation, so a fresh geometry is built each time).
164+
// Dispose the geometry from the previous update before replacing it (UpdateArc runs on every
165+
// progress tick during the entrance animation, so a fresh geometry is built each time). The new
166+
// geometry is owned by ArcPath.Data — assign it directly rather than via a throwaway local.
168167
(ArcPath.Data as IDisposable)?.Dispose();
169-
ArcPath.Data = geometry;
168+
ArcPath.Data = new PathGeometry { Figures = { figure } };
170169
}
171170

172171
private static Point PointOnCircle(double angleDegrees)

0 commit comments

Comments
 (0)