Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Twig Runtime Error – Twig\Error\RuntimeError –> The "map" filter expects a sequence or a mapping, got "stdClass". #22

Open
afairhurst opened this issue Jan 30, 2025 · 2 comments

Comments

@afairhurst
Copy link

Firstly, thank you for creating this fantastic plugin. I've been using it without issue for a while, but have today updated a site, which has subsequently caused the dashboard to fail. It seems the Plausible Dashboard widgets are causing the page to error.

Craft CMS 5.6.3
Plausible 3.1.0

The "map" filter expects a sequence or a mapping, got "stdClass".
values: [{{ timeResults|map(r => r.visitors)|join(', ') }}]

4950515253545556575859606162636465        {% for label in timeResults %}
            "{{ period == 'day' ? label.date|date('ga') : label.date|date('D, j M') }}"{{ not loop.last ? ', ' }}
        {% endfor %}
    {% endset %}
    <script type="text/javascript">
        var data = {
            labels: [{{ labels }}],
            datasets: [
                {
                    values: [{{ timeResults|map(r => r.visitors)|join(', ') }}]
                }
            ]
        }
    </script>
    <div class="overview-chart" id="chart"></div>
</div>
@shornuk
Copy link
Owner

shornuk commented Jan 30, 2025

Just having a look. I've just updated a site to 5.6.3 and I'm not getting this error.
Is this a site that already had the plugin running? Already set up etc?

@afairhurst
Copy link
Author

Thanks for looking into it. Yes everything was running fine prior to the update.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants