mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-24 14:43:08 +03:00
Fixed visibility updating announcement bar in AdminX (#18058)
no issue
- fixed an issue where toggling the visibility of the announcement bar doesn't update the preview.
---
<!-- Leave the line below if you'd like GitHub Copilot to generate a
summary from your commit -->
<!--
copilot:summary
-->
### <samp>🤖 Generated by Copilot at bad7a08</samp>
Simplified the `AnnouncementBarPreview` component by using a shallow
equality check for the `visibility` prop. This is part of a refactor to
use React hooks and functional components.
This commit is contained in:
parent
210de7fa11
commit
3755384b66
@ -96,18 +96,10 @@ export default memo(AnnouncementBarPreview, (prevProps, nextProps) => {
|
||||
}
|
||||
|
||||
// Check if visibility array changed in size or content
|
||||
if (prevProps.visibility?.length !== nextProps.visibility?.length) {
|
||||
if (prevProps.visibility !== nextProps.visibility) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (prevProps.visibility && nextProps.visibility) {
|
||||
for (let i = 0; i < prevProps.visibility.length; i++) {
|
||||
if (prevProps.visibility[i] !== nextProps.visibility[i]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If we've reached this point, all props are the same
|
||||
return true;
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user