renamed isPending to hasUnsavedChanges for clarity