diff --git a/.eslintrc.js b/.eslintrc.js index 335598e..3d9a52f 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -20,7 +20,7 @@ module.exports = { google: "writable", gtag: "writable", SETTINGS: "writable", - Turbolinks: "writable", + Turbo: "writable", }, parser: "@typescript-eslint/parser", parserOptions: { diff --git a/Gemfile b/Gemfile index 4209ddb..7f0a226 100644 --- a/Gemfile +++ b/Gemfile @@ -30,9 +30,8 @@ gem 'sass-rails' # Automatically add vendor prefixes to CSS rules gem 'autoprefixer-rails' -# Turbolinks makes navigating your web application faster. -# Read more: https://github.com/turbolinks/turbolinks -gem 'turbolinks', '~> 5' +# Improves app performance by using Hotwire +gem 'turbo-rails', '~> 1.1.1' # Application monitoring gem 'newrelic_rpm' @@ -131,3 +130,6 @@ group :test do gem 'webdrivers' gem 'webmock' end + +# Use Redis for Action Cable +gem 'redis', '~> 4.0' diff --git a/Gemfile.lock b/Gemfile.lock index 6f0e149..df38c41 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -352,9 +352,10 @@ GEM thor (1.2.1) tilt (2.0.10) timeout (0.2.0) - turbolinks (5.2.1) - turbolinks-source (~> 5.2) - turbolinks-source (5.2.0) + turbo-rails (1.1.1) + actionpack (>= 6.0.0) + activejob (>= 6.0.0) + railties (>= 6.0.0) tzinfo (2.0.4) concurrent-ruby (~> 1.0) unicode-display_width (2.1.0) @@ -423,6 +424,7 @@ DEPENDENCIES rack-timeout rails (~> 7) react-rails + redis (~> 4.0) rspec-rails rspec_junit_formatter rubocop @@ -438,7 +440,10 @@ DEPENDENCIES shoulda-matchers sidekiq simplecov - turbolinks (~> 5) + spring + spring-commands-rspec + spring-watcher-listen (~> 2.0.0) + turbo-rails (~> 1.1.1) web-console (>= 3.3.0) webdrivers webmock diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index 93eb60f..6cd292e 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -10,7 +10,6 @@ // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details // about supported directives. // -//= require turbolinks //= require jquery/dist/jquery //= require jquery-ujs/src/rails //= require popper.js/dist/umd/popper diff --git a/app/assets/javascripts/google_analytics.js b/app/assets/javascripts/google_analytics.js index d3019c3..454c3e8 100644 --- a/app/assets/javascripts/google_analytics.js +++ b/app/assets/javascripts/google_analytics.js @@ -1,4 +1,4 @@ -$(document).on("turbolinks:load", () => { +$(document).on("turbo:load", () => { if ( typeof gtag === "function" && typeof SETTINGS.google_analytics_id !== "undefined" diff --git a/app/javascript/packs/application.js b/app/javascript/packs/application.js index 37f1e1f..b398c15 100644 --- a/app/javascript/packs/application.js +++ b/app/javascript/packs/application.js @@ -1,4 +1,5 @@ import * as Sentry from "@sentry/browser"; +import "@hotwired/turbo-rails"; // Support component names relative to this directory: const componentRequireContext = require.context("views", true); diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index cc6caaa..4449575 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -7,10 +7,10 @@ <%= yield(:page_title).presence || t('app.default_title') %> <%= render partial: 'layouts/js_setup' %> - <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %> + <%= stylesheet_link_tag 'application', media: 'all'%> <%= render partial: 'layouts/google_analytics' %> - <%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %> - <%= javascript_packs_with_chunks_tag 'application', 'data-turbolinks-track': 'reload' %> + <%= javascript_include_tag 'application'%> + <%= javascript_packs_with_chunks_tag 'application' %> <%= csrf_meta_tags %> <%= render partial: 'layouts/favicon' %> diff --git a/config/cable.yml b/config/cable.yml index cef17c5..b8dfc54 100644 --- a/config/cable.yml +++ b/config/cable.yml @@ -1,5 +1,6 @@ development: - adapter: async + adapter: redis + url: redis://localhost:6379/1 test: adapter: test diff --git a/package.json b/package.json index bdcd96a..2a58ea9 100644 --- a/package.json +++ b/package.json @@ -20,6 +20,7 @@ "@babel/plugin-proposal-nullish-coalescing-operator": "^7.8.3", "@babel/preset-react": "^7.0.0", "@babel/preset-typescript": "^7.3.3", + "@hotwired/turbo-rails": "^7.1.3", "@rails/webpacker": "^4.0.7", "@sentry/browser": "^5.11.0", "@testing-library/react-hooks": "^3.2.1", diff --git a/yarn.lock b/yarn.lock index f61d2cf..b6a9fe0 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1021,6 +1021,19 @@ resolved "https://registry.yarnpkg.com/@gar/promisify/-/promisify-1.1.3.tgz#555193ab2e3bb3b6adc3d551c9c030d9e860daf6" integrity sha512-k2Ty1JcVojjJFwrg/ThKi2ujJ7XNLYaFGNB/bWT9wGR+oSMJHMa5w+CUq6p/pVrKeNNgA7pCqEcjSnHVoqJQFw== +"@hotwired/turbo-rails@^7.1.3": + version "7.1.3" + resolved "https://registry.yarnpkg.com/@hotwired/turbo-rails/-/turbo-rails-7.1.3.tgz#a4e04ecb800a06e7f9aa6e298170fa4580b74216" + integrity sha512-6qKgn75bMWKx0bJgmSfrdC73EJkGLoSWZPAssvcd3nE7ZpDZff6f67j5OQNjjpRgNB7OFruom6VWguGQGu1fQg== + dependencies: + "@hotwired/turbo" "^7.1.0" + "@rails/actioncable" "^7.0" + +"@hotwired/turbo@^7.1.0": + version "7.1.0" + resolved "https://registry.yarnpkg.com/@hotwired/turbo/-/turbo-7.1.0.tgz#27e44e0e3dc5bd1d4bda0766d579cf5a14091cd7" + integrity sha512-Q8kGjqwPqER+CtpQudbH+3Zgs2X4zb6pBAlr6NsKTXadg45pAOvxI9i4QpuHbwSzR2+x87HUm+rot9F/Pe8rxA== + "@istanbuljs/load-nyc-config@^1.0.0": version "1.1.0" resolved "https://registry.yarnpkg.com/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz#fd3db1d59ecf7cf121e80650bb86712f9b55eced" @@ -1246,6 +1259,11 @@ dependencies: prettier ">=1.10" +"@rails/actioncable@^7.0": + version "7.0.3" + resolved "https://registry.yarnpkg.com/@rails/actioncable/-/actioncable-7.0.3.tgz#71f08e958883af64f6a20489318b5e95d2c6dc5b" + integrity sha512-Iefl21FZD+ck1di6xSHMYzSzRiNJTHV4NrAzCfDfqc/wPz4xncrP8f2/fJ+2jzwKIaDn76UVMsALh7R5OzsF8Q== + "@rails/webpacker@^4.0.7": version "4.3.0" resolved "https://registry.yarnpkg.com/@rails/webpacker/-/webpacker-4.3.0.tgz#3793b3aed08ed0b661f1bed9de0739abacb6a834"