1

I'm having an issue with Sprig + Blitz Caching. I'm trying to load a user image if currentUser exists, though I'm having an issue with the caching. Sprig is loading in the unregistered user photo when logged in. I'm unsure if it's setup right.

      {{ sprig('components/_componentUser', {}, {
        's-trigger': 'refresh, load'
      }) }}

Then in my _componentUser

  {% if currentUser %}
            <li class="nav-item position-relative">
                <a class="nav-link py-3" href="/account" data-toggle="tooltip" data-placement="bottom" title="My Account">
                  <div class="account-circle">
                        <img src="{{ craft.gravatar.url(currentUser.email) }}" width="34" class="rounded-circle"/>
                  </div>
                </a>
            </li>
            {% else %}
            <li class="nav-item position-relative">
                <a class="nav-link" href="/account" data-toggle="tooltip" data-placement="bottom" title="My Account">
                  <div class="account-circle">
                        <span class="material-icons" data-icon="account_circle"></span>
                  </div>
                </a>
            </li>
  {% endif %}

1 Answer 1

1

Duplicate of https://github.com/putyourlightson/craft-sprig/issues/118

The code is correct and what you are experiencing is likely due to local browser caching.

1
  • Thanks Ben. Appreciated.
    – JMKelley
    Mar 27, 2021 at 13:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.