-
Notifications
You must be signed in to change notification settings - Fork 2
fix: device lock status disappearing when unlocked #709
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Discussed in thread: https://hello-seam.slack.com/archives/C05FXN0QYH0/p1759185704232699 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The original file was actually intentional as a pattern for Seam Components to put stuff that defines its concept of a Lock (Thermostat, etc.).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
useLockDoor/useUnlockDoor / use-(un)lock-door.ts
if (!device.properties.online) { | ||
return null | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is already contained in can_remotely_lock / can_remotely_unlock
if (!device.properties.online) { | |
return null | |
} |
return ( | ||
<div className='seam-content seam-lock-status'> | ||
<div> | ||
<span className='seam-label'>{t.lockStatus}</span> | ||
<span className='seam-value'>{t.statusUnknown}</span> | ||
</div> | ||
<div className='seam-right'> | ||
<Button | ||
size='small' | ||
onClick={() => { | ||
lock.mutate(device) | ||
}} | ||
> | ||
{t.lock} | ||
</Button> | ||
<Button | ||
size='small' | ||
onClick={() => { | ||
unlock.mutate(device) | ||
}} | ||
> | ||
{t.unlock} | ||
</Button> | ||
</div> | ||
</div> | ||
) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For this last condition
Cannot lock or unlock = show unknown status + both lock/unlock buttons
We should not show ANY buttons or any row. If cannot lock or unlock then the buttons are not going to work.
Closes https://linear.app/seam/issue/CX-450/status-field-disappears-when-clicking-unlock-button-in-seam-components
Previously we were hiding the toggle to prevent the case where the device doesn't report lock status.
This PR conditionally renders buttons depending on whether the device has capability to unlock/lock:
Screenshots