I can see the changes I made (as an administrator) but as an anonymous user, I can't Have you had any problems like this before? I appreciate your help.

When I'm an admin and update a node (custom module), I can see the changes I made (as an administrator). However, when I'm an anonymous user, just to check the data, I can't see the changes I made. (note: I have flushed the site, it will work, but only when I run flush)

I thought it was something related with the permission, from a Custom module I created, but I'm not sure of that. I included a permission.yml file and gave full access. It didn't work.

find the attached images: 



I had built the code in the Controller folder/file:
I have two public functions called retrieveArrayOne and retrieveArrayTwo. Each one has different data for me to query later (retrieving the data from these two functions).

public function mainviewlist() {
  $array1 = array($this-&gt;retrieveArrayTwo());
  $array2 = array($this-&gt;retrieveArrayOne());
  $retrieveData = array_merge($array1, $array2);
  $content = "&lt;H2&gt;&lt;/H2&gt;";
  foreach ($retrieveData as $key1 =&gt; $finalValues) {
    if ($key1 == 0) {
      foreach ($finalValues as $disCrop) {
        $content .= "&lt;details&gt;";
        $content .= '&lt;summary&gt;' . $disCrop . '&lt;/summary&gt;';
        $content .= "&lt;/details&gt;";
      }
    }
  }
  return array(
    '#type'     =&gt; 'markup',
    '#markup'   =&gt; $content,
    '#attached' =&gt; array(
      'library' =&gt; array(
        'modulename/modulename',

      ),
    ),
  );
}


Here is the function from the $array1 and array2. Both are similar.

$query = \Drupal::entityQuery('node');
$query-&gt;condition('status', 1);
$query-&gt;condition('type', 'content-type-name');
$query-&gt;sort('title', 'ASC');
$entity = $query-&gt;execute();
$options = array();

foreach ($entity as $n) {
  $node = \Drupal\node\Entity\Node::load($n);
  $options[$node-&gt;id()] = $node-&gt;getTitle();
  $elementA[] = [//
    'nid'        =&gt; $node-&gt;get('nid')-&gt;value,
    'title'      =&gt; $node-&gt;get('title')-&gt;value,
    'body'       =&gt; $node-&gt;get('body')-&gt;value,
    'field_crop' =&gt; $node-&gt;get('field_crop')-&gt;value,
  ];
}

return $elementA;
OK, I found the problem. 

In my routing file, I was missing:

  options:
    no_cache: TRUE


That fixed it.