But what's the best way to fix loose edges before painting? I mean, if you just paint over them, like @river_torres said, it can bubble and rip later. Idk, maybe it's just me but I've seen this happen a lot where a small spot turns into a big mess. You really need to scrape off any loose paint and sand it smooth until the surface is even. Then you should prime the bare spots so the new paint sticks better. Otherwise, the new paint won't stick right and you'll end up with peeling again. It's more work upfront, but it saves you from having to redo the whole thing later.
Yikes, river_torres is totally right! If you paint over a loose edge, it doesn't just bubble, it can rip and pull up a huge section. Makes the whole mess so much worse.