It's not fully clear what you're trying to accomplish here. Would you like to hide certain elements? In that case, the shinyjs package can help.
Issues with Shiny code can stem from both the reactive Shiny code itself or the regular R code used in the functions. In order for us to help you with your question, please provide us a minimal reprocudible example (Reprex) where you provide a minimal (dummy) dataset and code that can recreate the issue. One we have that, we can go from there. For help on creating a Reprex, see this guide: