Photos app on Mac M1 MacOS Sonoma not working and not syncing with iCloud
I run MacOS Sonoma on a MacBook Pro M1. I use iCloud Photo Library. I also use it on my iPhone, iPad and my other MacBook Pro M1 (identical model at my office.)
I'm having major issues with the photos app on one of my MacBook Pro laptops. Here are the problems: the other day it said it was repairing the database when I opened the app. It took a long time. Once it was finished it wasn't updated with the last 300 photos I'd imported from my other MacBook Pro at my office. My other devices had no problems updating. When I tried to turn iCloud off it was unresponsive, both in iCloud settings and in settings on the photos app. Once I got it turned off it didn't erase the library from the app. The photos remained (I have optimized library as default on) Then I tried turning it back on, it still didn't try to sync up. I tried erasing a photo but then it became unresponsive again and I had to force quit. I tried to edit a photo and it starts to download the photo but then comes to a halt when it's almost finished. Then I tried to log out of apple-id in iCloud, logged back on, nothing had changed. Then I tried to install a new version of MacOS Sonoma with the same result. The difference is that the library kept getting smaller and smaller down to a couple thousands photos (my library has approx 46400 photos.) I've tried to reboot many times, but there's no results. What to do?
See attached screenshot from the bottom of the photos app, it's in Swedish but it says "1446 photos, 7 videos" and "synchronising 43038 photos from iCloud"