mirror of
https://github.com/smittix/intercept.git
synced 2026-04-26 07:40:01 -07:00
fix(bluetooth): fix locate button not switching to bt_locate mode
Remove the split fast-path in doLocateHandoff that called BtLocate.handoff()
directly when the module was already loaded. That path relied on handoff()
internally calling switchMode, causing a double switchMode in the lazy-load
path and no guaranteed mode switch in the fast path.
Now doLocateHandoff always calls switchMode('bt_locate') first (lazy-loading
script/styles as needed), then calls BtLocate.handoff() in .then(). Removed
the redundant switchMode call from BtLocate.handoff() since the caller owns
the mode transition.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1790,14 +1790,8 @@ const BluetoothMode = (function() {
|
||||
mac_cluster_count: device.mac_cluster_count || 0
|
||||
};
|
||||
|
||||
// If BtLocate is already loaded, hand off directly
|
||||
if (typeof BtLocate !== 'undefined') {
|
||||
BtLocate.handoff(payload);
|
||||
return;
|
||||
}
|
||||
|
||||
// Switch to bt_locate mode first — this loads the script, styles,
|
||||
// and initializes the module. Then hand off the device data.
|
||||
// Always switch to bt_locate mode first (loads script + styles if needed,
|
||||
// initializes the module), then hand off device data.
|
||||
if (typeof switchMode === 'function') {
|
||||
switchMode('bt_locate').then(function() {
|
||||
if (typeof BtLocate !== 'undefined') {
|
||||
|
||||
Reference in New Issue
Block a user