Refreshing and rebuilding content
The content toolbar in Posit Connect has two buttons that run your content again without a new publish: Refresh and Rebuild. Refresh renders a document again. Rebuild deploys the active bundle of an application or API again.
Neither button changes your source code. To change the code, publish a new bundle.
Refresh
Refresh appears for rendered documents, such as R Markdown, Quarto, and Jupyter content. It renders the document again with the active bundle. Connect uses the environment that is already in place. It does not reinstall packages.
After the render finishes, viewers see the new output. Connect adds the render to the report history. If the render fails, viewers continue to see the most recent successful output.
For a parameterized report, Refresh renders the variant that you are viewing. Other variants keep their output until they render on a schedule or until you refresh them. Refresh is not available while you have unsaved changes to the parameters.
When to use Refresh
Use Refresh when the input to a document changes and the code does not. For example, a daily sales report reads from a database. New orders arrive at noon, and you want the report to show them now. Click Refresh to render the report now. You do not have to wait for the next scheduled run.
To render content on a regular schedule, see Scheduling. To render content from a script, see the Rendering content recipe in the Connect Cookbook.
Rebuild
Rebuild appears for content that runs in processes. This includes applications, APIs, and interactive documents, such as Shiny, Streamlit, Dash, FastAPI, and Plumber content.
Rebuild deploys the active bundle again and activates it. Connect restores the R or Python environment for the bundle and then starts new processes for the content. Connect opens the build log, so you can follow the deployment.
New visitors use the new processes. Rebuild does not interrupt visitors who have the content open. For more information, see Changing an active bundle.
When to use Rebuild
Use Rebuild when the code does not change, but the server around it changes. The following examples show when to use Rebuild:
- An application fails to deploy because a system library is missing. Your administrator installs the library, and you want to try the deployment again.
- Your administrator changes the server configuration, such as the package repository URL or the Python version. You want the content to build again with the new configuration.
Rebuild is the same as the Activate action for the active bundle in the Bundles dialog.
Restart without a rebuild
Rebuild restores the environment, and that can take time. If you want only new processes, restart the content from a script instead. For example, restart an application to load a new dataset into memory. For the steps, see the Restarting content recipe in the Connect Cookbook.