Let the date range be opened before there is a date range
Build and test / Desktop (Linux) (push) Failing after 2m16s
Build and test / Layer separation (push) Successful in 23s
🐳 Android image / Build and push (push) Successful in 3s
Build and test / android-image (push) Successful in 3s
Traceability / Requirement traces (push) Failing after 59s
Build and test / Android (aarch64) (push) Failing after 6s
Build and test / Desktop (Linux) (push) Failing after 2m16s
Build and test / Layer separation (push) Successful in 23s
🐳 Android image / Build and push (push) Successful in 3s
Build and test / android-image (push) Successful in 3s
Traceability / Requirement traces (push) Failing after 59s
Build and test / Android (aarch64) (push) Failing after 6s
Pressing "limit to range" did nothing, and the reason was two early returns that sat above the line which shows the controls. If the catalog was not open, or nothing in it carried a capture date, the handler returned before `set_library_range_active`, so no state changed and nothing appeared. Capture dates are read from EXIF as thumbnails load, so a freshly opened library has none — the button was inert on exactly the libraries where someone is most likely to go looking for a date, and it failed by doing nothing at all, which is the hardest failure to report. Underneath that was a smaller mistake with the same shape: whether the controls showed was read from whether a range was set. The fields are how a range gets set, so requiring one before they appear is a door locked from the inside. The panel has its own state now, and the timeline span is a seed for the fields rather than a precondition for them — no span means two empty fields waiting to be typed into, which is a way to choose a range rather than a refusal to offer one. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
+27
-12
@@ -4640,26 +4640,41 @@ pub fn wire<F>(
|
||||
let ctl = ctl.clone();
|
||||
window.on_library_toggle_date_range(move || {
|
||||
let Some(w) = weak.upgrade() else { return };
|
||||
let on = !ctl.filter.borrow().has_date_range();
|
||||
// Whether the *controls* are showing, which is not the same as
|
||||
// whether a range is set — and reading it from the filter was why
|
||||
// pressing this did nothing. The fields are how a range gets set,
|
||||
// so requiring one before they appear is a door locked from the
|
||||
// inside.
|
||||
let on = !w.get_library_range_active();
|
||||
if on {
|
||||
// The span the axis is currently drawn over, which is what the
|
||||
// user is looking at when they ask for "this range".
|
||||
// Seeded from the span the axis is drawn over, which is what
|
||||
// the user is looking at when they ask for "this range".
|
||||
//
|
||||
// Only a seed. If there is no catalog yet, or nothing in it
|
||||
// carries a capture date — dates are read from EXIF as
|
||||
// thumbnails load, so a freshly opened library has none — the
|
||||
// fields simply open empty and wait to be typed into. This
|
||||
// used to `return` in both cases, which meant the button
|
||||
// silently did nothing on exactly the libraries where a person
|
||||
// is most likely to be looking for a date.
|
||||
let seeded = {
|
||||
let borrow = ctl.catalog.borrow();
|
||||
let Some(catalog) = borrow.as_ref() else {
|
||||
return;
|
||||
};
|
||||
let Some(span) = catalog_span(catalog, &ctl) else {
|
||||
return;
|
||||
};
|
||||
let (from, to) = zoomed_span(
|
||||
borrow
|
||||
.as_ref()
|
||||
.and_then(|catalog| catalog_span(catalog, &ctl))
|
||||
.map(|span| {
|
||||
zoomed_span(
|
||||
span,
|
||||
*ctl.timeline_zoom.borrow(),
|
||||
*ctl.timeline_centre.borrow(),
|
||||
);
|
||||
drop(borrow);
|
||||
)
|
||||
})
|
||||
};
|
||||
if let Some((from, to)) = seeded {
|
||||
let mut f = ctl.filter.borrow_mut();
|
||||
f.captured_from = Some(from);
|
||||
f.captured_to = Some(to);
|
||||
}
|
||||
} else {
|
||||
let mut f = ctl.filter.borrow_mut();
|
||||
f.captured_from = None;
|
||||
|
||||
Reference in New Issue
Block a user