1. Water, then 2. structure
Liquid water is corrected first — drainage, a sump pump, and the outside grading and downspouts feeding it. Structural work comes next, because framing repaired while the source is still active is exposed to the same conditions that damaged it. Where wood has already decayed, that is wood rot repair rather than a moisture problem alone.