only use effect when string is not empty