What is the correct way to render on demand

Most of the solutions shown here do no longer work since version 5.29 (see On-demand rendering solution broken since 5.29)