diff --git a/app/javascript/native.js b/app/javascript/native.js index ef6c086c1..87afa5e32 100644 --- a/app/javascript/native.js +++ b/app/javascript/native.js @@ -57,11 +57,23 @@ if (handlers?.native && window === window.top) { const reportPathConfiguration = () => { const element = document.getElementById('native_path_configuration') - if (element) handlers.native.postMessage({ type: 'path-configuration', json: element.textContent }) + if (!element) return + + const config = JSON.parse(element.textContent) + + config.rules.forEach(({ properties }) => { + if (properties.native_actions) properties.native_actions = properties.native_actions.map(nativeIcon) + }) + + handlers.native.postMessage({ type: 'path-configuration', json: JSON.stringify(config) }) } document.addEventListener('turbo:load', reportPathConfiguration) + document.addEventListener('turbo:before-cache', () => { + document.getElementById('native_path_configuration')?.remove() + }) + reportPathConfiguration() const reportFlash = (element) => { diff --git a/app/views/shared/_settings_nav.html.erb b/app/views/shared/_settings_nav.html.erb index e12b42a16..d3f458396 100644 --- a/app/views/shared/_settings_nav.html.erb +++ b/app/views/shared/_settings_nav.html.erb @@ -10,7 +10,7 @@ <% end %>