The isolate() function

isolate() is a function that does exactly what is expected; it isolates a piece of code. In a Shiny reactive context, this means that it prevents the execution of a piece of code unless, of course, certain condition is met. The condition that isolate() takes in order to re-execute the piece of code is, however, not evaluated in the usual way (that is, in the way that returns TRUE or FALSE), it evaluates whether the object changes or not.

The object to evaluate the condition that is mostly used within isolate() is the action button. The actionButton() function, apart from drawing a button in the interface, creates an object, which is mainly a counter that whenever the button is hit, it increases its value by 1. It becomes ...

Get Learning Shiny now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.