Unfortunately, the problem has not gone away.
I have noticed a new one, on the subpage where I download photos or videos from the API after refreshing the content is not downloading.
Below I put component which is fetching photos
const AstroPage = ({ state, libraries }) => {
  const [currentImage, setCurrentImage] = useState(0);
  const [viewerIsOpen, setViewerIsOpen] = useState(false);
 
  const [data, setData] = useState({
    isReady: false,
    items: []
  });
  useEffect(() => {
    getMedia( libraries, state, setData);
   
  }, [])
  const images = data.isReady && data.items.map(({ type, id }) => state.source[type][id])
  console.log('data', images)
  let imageLinks = [];
  let imageSmall = [];
   images && images.map(image => {
     imageLinks.push({
         src: image.media_details.sizes.full.source_url,
          width: 4,
          height: 3,
          title: image.title.rendered,
       })
     });
   images && images.map(image => {
      imageSmall.push({
         src: image.media_details.sizes.medium.source_url,
         width: 4,
         height: 3,
       })
     });
  const openLightbox = useCallback((event, { photo, index }) => {
    setCurrentImage(index);
    setViewerIsOpen(true);
  }, []);
  const closeLightbox = () => {
    setCurrentImage(0);
    setViewerIsOpen(false);
  };
  return (
    <>
    {data.items.length === 0 ? 
      < BackdropWrapper>
          <Indicator color="inherit" />
      </ BackdropWrapper>
    
    :
    <GalleryWrapper>
      <Gallery photos={imageSmall} onClick={openLightbox}/>
      <ModalGateway>
      {viewerIsOpen ? (
        <Modal onClose={closeLightbox}>
          <Carousel
            currentIndex={currentImage}
            views={imageLinks.map(x => ({
              ...x,
              srcset: x.srcSet,
              caption: x.title,
              
            }))}
          />
        </Modal>
      ) : null}
    </ModalGateway> 
</GalleryWrapper>
    }
    </>
  );
};
export default connect(AstroPage)
const getMedia = async ( libraries, state, setData) => {
  // Get other images
  const response = await libraries.source.api.get({
    endpoint: "media",
    params: { 
        parent: "43",
        per_page: '100'
    }, 
  });
  const entitiesAdded = await libraries.source.populate({ response, state });
  await setData({
    isReady: true,
    items: entitiesAdded
  });
};
Thank you,
I noticed problems after put project on the server, on localhost everything is fine.