It can depend on different things...
JUDGMENT LIEN CONSIDERATION
Generally, once a judgment is entered against a person, that judgment will attach to the person's real estate as a judgment lien, usually making refinancing or selling the property impossible without paying off the judgment lien, which grows with statutory interest.
Judgment liens can often be removed in bankruptcy by a process called lien avoidance in 11 USC 522(f), but sometimes they cannot. Whether they can or cannot depends on if the property is completely exempt or only partially exempt, and the calculations can become somewhat complex. So, if the person is one who has enough equity in real estate that he or she would be unable to remove judgment liens from his or her real estate in bankruptcy, he or she would want to file before the judgment is entered to ensure that no judgment lien attaches. If the person's real estate is sufficiently exempt, he or she may not care whether the bankruptcy happens before or after the judgment since it can be removed during the bankruptcy process (though often for higher attorneys fees).
CREDIT SCORE IMPACT?
One factor that may influence the decision a little is credit score impact. It is possible that a judgment against a person has a more negative credit impact than a pending lawsuit that is discharged in bankruptcy without reaching judgment. I am not really sure since credit reporting agencies keep how one's credit score is determined such a big industry secret (which seems odd to me).
LITIGATION OF POTENTIALLY NON-DISCHARGEABLE DEBT
Another factor that may influence when one files bankruptcy is which court he or she prefers if the nature of the debt is one which could potentially be deemed non-dischargeable. Some debts are not dischargeable in bankruptcy, such as death or personal injury caused by the debtor while driving a vehicle while intoxicated. So, if a person is getting sued for a situation like this, if the person feels he or she has a better chance of prevailing in the state court in proving that he or she was not drunk, then he or she may defend the lawsuit in the state court all the way to the end. If the person feels that the state court proceeding is going badly, he or she may instead opt to file bankruptcy before the judgment is rendered and try to litigate the matter in Bankruptcy Court, which is often more favorable for debtors.
GARNISHMENT, SEIZURE, ETC.
If the person has garnishable wages or money in bank accounts, he or she may want to file prior to the judgment being rendered since, once a judgment is rendered, the plaintiff may seek to garnish his or her wages, or freeze his or her bank accounts, among other state court remedies to collect judgments. Generally once a bankruptcy is filed, garnishments can normally be stopped, but the money seized between the start of the garnishment and the bankruptcy filing is lost forever. Money in frozen bank accounts often cannot be recovered at all, even with the bankruptcy filing (courts differ on this matter).
I'm sure there are other possible considerations that are not coming to me now, but hopefully that lets you know some of the things one might consider when selecting the timing for their bankruptcy case.
I hope this helps and a positive feedback is always appreciated if this was useful to you.
LEGAL NOTICE: I am only licensed to practice law in certain state(s) and I cannot give legal advice to someone who does not reside in a state in which I am licensed, nor shall anything I say in the above answer or elsewhere on this site be deemed legal advice, even to someone who resides in a state in which I am licensed. Fees I receive for answering questions are paid for information, not for legal advice. This forum is designed to provide general information only, and information herein is not warranted to be correct or applicable in any way since laws may have been misinterpreted herein, since laws change from time to time, and since the impact of those laws on any particular situation varies. The information presented in this site shall not be construed to be formal legal advice nor the formation of an attorney-client relationship. Persons accessing this response are encouraged to seek independent legal counsel in their jurisdiction for guidance regarding their individual circumstances. Do not take any action or inaction based on information presented herein since it is informational and may not be accurate or applicable to you; it merely attempts to give you a basis of knowledge to help you formulate questions to ask a legal or other professional in a face-to-face meeting in your jurisdiction. Joseph Ross does not hold himself out to be a specialist or expert in any area, regardless of assertions made by any third party, and any implication of being an expert or specialist herein is made in error. I hope the information presented above is useful to you. Answer above is (c) Joseph Ross. All rights reserved.