From e2278a07bdf3fb9454235ea96b3edfa828960397 Mon Sep 17 00:00:00 2001 From: lucke84 Date: Sun, 1 May 2016 18:53:52 +0200 Subject: [PATCH] Remove fragment at all: Addressable is able to recognize it but the fragment is never sent to the server so there's no point in try to read it. --- README.md | 1 - app/helpers/react_on_rails_helper.rb | 3 +-- spec/dummy/spec/features/rails_context_spec.rb | 5 ++--- spec/dummy/spec/requests/server_render_check_spec.rb | 3 +-- 4 files changed, 4 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 7f99713b0..d1d2dc12a 100644 --- a/README.md +++ b/README.md @@ -213,7 +213,6 @@ The `railsContext` has: (see implementation in file react_on_rails_helper.rb for port: uri.port, pathname: uri.path, # /posts search: uri.query, # id=30&limit=5 - fragment: uri.fragment, # time=1305298413 # Locale settings i18nLocale: I18n.locale, diff --git a/app/helpers/react_on_rails_helper.rb b/app/helpers/react_on_rails_helper.rb index a57f85307..5c852abd2 100644 --- a/app/helpers/react_on_rails_helper.rb +++ b/app/helpers/react_on_rails_helper.rb @@ -346,13 +346,12 @@ def rails_context(server_side:) result = { # URL settings href: request.original_url, - location: "#{uri.path}#{uri.query.present? ? "?#{uri.query}" : ''}#{uri.fragment.present? ? "##{uri.fragment}" : ''}", + location: "#{uri.path}#{uri.query.present? ? "?#{uri.query}" : ''}", scheme: uri.scheme, # http host: uri.host, # foo.com port: uri.port, pathname: uri.path, # /posts search: uri.query, # id=30&limit=5 - fragment: uri.fragment, # time=1305298413 # Locale settings i18nLocale: I18n.locale, diff --git a/spec/dummy/spec/features/rails_context_spec.rb b/spec/dummy/spec/features/rails_context_spec.rb index 2c4202297..4ef64abe7 100644 --- a/spec/dummy/spec/features/rails_context_spec.rb +++ b/spec/dummy/spec/features/rails_context_spec.rb @@ -10,7 +10,7 @@ background do set_driver_header("ACCEPT-LANGUAGE", http_accept_language) - visit "/#{pathname}?ab=cd#123" + visit "/#{pathname}?ab=cd#" end context pathname, :js do @@ -21,13 +21,12 @@ host_port = "#{host}:#{port}" keys_to_vals = { href: "http://#{host_port}/#{pathname}?ab=cd", - location: "/#{pathname}?ab=cd#123", + location: "/#{pathname}?ab=cd", port: port, scheme: "http", host: host, pathname: "/#{pathname}", search: "ab=cd", - fragment: "123", i18nLocale: "en", i18nDefaultLocale: "en", httpAcceptLanguage: http_accept_language, diff --git a/spec/dummy/spec/requests/server_render_check_spec.rb b/spec/dummy/spec/requests/server_render_check_spec.rb index 934f9d6a9..8840de2f0 100644 --- a/spec/dummy/spec/requests/server_render_check_spec.rb +++ b/spec/dummy/spec/requests/server_render_check_spec.rb @@ -66,12 +66,11 @@ def check_match(pathname, id_base) top_id = "##{id_base}-react-component-0" keys_to_vals = { href: "http://www.example.com/#{pathname}?ab=cd", - location: "/#{pathname}?ab=cd#123", + location: "/#{pathname}?ab=cd", scheme: "http", host: "www.example.com", pathname: "/#{pathname}", search: "ab=cd", - fragment: "123", i18nLocale: "en", i18nDefaultLocale: "en", httpAcceptLanguage: http_accept_language,