Merge branch 'master' into refactor-navigation

This commit is contained in:
Trevor Buckner
2026-10-13 12:09:09 -04:00
committed by GitHub
7 changed files with 141 additions and 36 deletions
+12 -8
View File
@@ -46,21 +46,25 @@ const SharePage = (props)=>{
document.addEventListener('keydown', handleControlKeys);
fetchThemeBundle(undefined, setThemeBundle, currentBrew.renderer, currentBrew.theme);
// listen for changes in the brew version
const eventSource = new EventSource('/stream');
eventSource.addEventListener('message', (evt)=>{
const messageData = JSON.parse(evt.data);
let eventSource;
// Start a stream if the brew has been updated in the last month
if(Date.parse(props.brew?.updatedAt) > (new Date).setDate((new Date).getDate() - 30)){
// listen for changes in the brew version
eventSource = new EventSource(`/api/stream/${props.brew.shareId}`);
if(messageData.eventType == 'brewUpdated'){
if(messageData.shareId == currentBrew.shareId && messageData.version != currentBrew.version) {
eventSource.addEventListener('brewUpdated', (evt)=>{
const messageData = JSON.parse(evt.data);
if(messageData.version != currentBrew.version) {
console.log('should fetch brew');
fetchUpdatedBrew();
}
}
});
});
}
return ()=>{
document.removeEventListener('keydown', handleControlKeys);
eventSource?.close();
};
}, []);
console.log('brew: ', currentBrew);
+16 -6
View File
@@ -68,7 +68,7 @@ const VaultPage = (props)=>{
updateStateWithBrews([], 1);
});
if(response.ok)
if(response?.ok)
updateStateWithBrews(response.body.brews, page);
};
@@ -342,13 +342,23 @@ const VaultPage = (props)=>{
}
if(error) {
const errorText = ErrorIndex()[error.HBErrorCode.toString()] || '';
if(error.HBErrorCode === undefined) {
return (
<div className='foundBrews noBrews'>
<h3>{error.toString()}</h3>
</div>
)
} else {
return (
<div className='foundBrews noBrews'>
const errorText = ErrorIndex()[error.HBErrorCode.toString()] || '';
return (
<div className='foundBrews noBrews'>
<h3>Error: {errorText}</h3>
</div>
);
</div>
);
}
}
if(!brewCollection) {