MiniProfiler / rack-mini-profiler

Profiler for your development and production Ruby rack apps.
MIT License
3.7k stars 402 forks source link

Setup for SPA not working #479

Closed ivanyv closed 2 years ago

ivanyv commented 3 years ago

I ran into some issues\ trying to install the profiler on a Vue app. First, I had to modify the script tag from the example in the README, as it was missing two required data attributes (data-hidden-custom-fields data-html-container="body").

Then I was getting this error in the console: POST http://localhost:3000/mini-profiler-resources/results 404 (Not Found). Which I traced to using "wrong" data-id / data-ids values.

I ended up with this:

<script type="text/javascript" id="mini-profiler"
        src="/mini-profiler-resources/includes.js?v=10da952c710f6abd9f1bd50fe50ed714"
        data-css-url="/mini-profiler-resources/includes.css?v=10da952c710f6abd9f1bd50fe50ed714"
        data-version="10da952c710f6abd9f1bd50fe50ed714" data-path="/mini-profiler-resources/"
        data-horizontal-position="left" data-vertical-position="top"
        data-ids=""
        data-trivial="false" data-children="false" data-max-traces="20" data-controls="false"
        data-total-sql-count="false" data-authorized="true" data-toggle-shortcut="alt+p" data-start-hidden="false"
        data-collapse-results="true" data-html-container="body" data-hidden-custom-fields></script>

I could create a PR for updating the docs if that helps (and above looks right).

eweitz commented 2 years ago

@ivanyv, many thanks! I encountered the same problems, and your solution worked for me. Such a PR would help.

(I'm using React and Rails.)

katelovescode commented 2 years ago

Lifesaver! Was just running into this issue and adding the custom data tags!!! Thank you so much.