Skip to content

Commit

Permalink
[Address feedback] Refactor based on configuration setting
Browse files Browse the repository at this point in the history
  • Loading branch information
ceritium committed Jun 15, 2021
1 parent 2826fc6 commit fa93363
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 5 deletions.
7 changes: 5 additions & 2 deletions lib/html/includes.js
Expand Up @@ -666,7 +666,7 @@ var _MiniProfiler = (function() {
);
}

if (typeof Turbo !== "undefined") {
if (options.hotwireTurboDriveSupport) {
document.addEventListener("turbo:before-visit", onTurboBeforeVisit)
document.addEventListener("turbo:load", onTurboLoad)
}
Expand Down Expand Up @@ -1053,6 +1053,8 @@ var _MiniProfiler = (function() {
.getAttribute("data-hidden-custom-fields")
.toLowerCase()
.split(",");
var hotwireTurboDriveSupport = script
.getAttribute('data-turbo-permanent') === "true";
return {
ids: ids,
path: path,
Expand All @@ -1071,7 +1073,8 @@ var _MiniProfiler = (function() {
collapseResults: collapseResults,
htmlContainer: htmlContainer,
cssUrl: cssUrl,
hiddenCustomFields: hiddenCustomFields
hiddenCustomFields: hiddenCustomFields,
hotwireTurboDriveSupport: hotwireTurboDriveSupport
};
})();

Expand Down
2 changes: 1 addition & 1 deletion lib/html/profile_handler.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/mini_profiler/asset_version.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
module Rack
class MiniProfiler
ASSET_VERSION = '40756d3425f8c8e3f901fb5e850a065a'
ASSET_VERSION = 'ec6d5541ecbc11a48798626c16a61342'
end
end
3 changes: 2 additions & 1 deletion lib/mini_profiler/config.rb
Expand Up @@ -57,6 +57,7 @@ def self.default
@snapshots_transport_auth_key = nil
@snapshots_redact_sql_queries = true
@snapshots_transport_gzip_requests = false
@enable_hotwire_turbo_drive_support = false

self
}
Expand All @@ -69,7 +70,7 @@ def self.default
:skip_schema_queries, :storage, :storage_failure, :storage_instance,
:storage_options, :user_provider, :enable_advanced_debugging_tools,
:skip_sql_param_names, :suppress_encoding, :max_sql_param_length,
:content_security_policy_nonce
:content_security_policy_nonce, :enable_hotwire_turbo_drive_support

# ui accessors
attr_accessor :collapse_results, :max_traces_to_show, :position,
Expand Down
1 change: 1 addition & 0 deletions lib/mini_profiler/profiler.rb
Expand Up @@ -751,6 +751,7 @@ def get_profile_script(env)
htmlContainer: @config.html_container,
hiddenCustomFields: @config.snapshot_hidden_custom_fields.join(','),
cspNonce: content_security_policy_nonce,
hotwireTurboDriveSupport: @config.enable_hotwire_turbo_drive_support,
}

if current && current.page_struct
Expand Down

0 comments on commit fa93363

Please sign in to comment.