This repository has been archived by the owner on Jan 10, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 225
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1566 from Shopify/rescue_no_react_server
Use custom error page to wait react server boot
- Loading branch information
Showing
12 changed files
with
67 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,4 +8,5 @@ group :test do | |
gem 'minitest-hooks' | ||
gem 'mocha' | ||
gem 'pry' | ||
gem 'sqlite3' | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
gems/quilt_rails/app/views/quilt/ui/react_render_error.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>React Render Error</title> | ||
<meta name="viewport" content="width=device-width,initial-scale=1"> | ||
<meta http-equiv="refresh" content="3;URL='/'" /> | ||
<link rel="stylesheet" href="https://unpkg.com/@shopify/polaris@5.1.0/dist/styles.css" /> | ||
</head> | ||
<body> | ||
<div> | ||
<div> | ||
<h1>Waiting for React Sever to boot up.</h1> | ||
<p>This page will refresh automatically.</p> | ||
</div> | ||
<p> | ||
If this error persists, ensure <code>@shopify/react-server</code> | ||
is running on <code>http://localhost:8081</code>. | ||
</p> | ||
</div> | ||
</body> | ||
</html> |
28 changes: 28 additions & 0 deletions
28
gems/quilt_rails/test/controllers/quilt/ui_controller_test.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# frozen_string_literal: true | ||
|
||
require "test_helper" | ||
require "action_controller" | ||
|
||
module Quilt | ||
class UiControllerTest < ActionDispatch::IntegrationTest | ||
include ActiveSupport::Testing::Isolation | ||
|
||
setup { boot_dummy } | ||
|
||
test "react render error" do | ||
get("/") | ||
|
||
assert_select("h1", "Waiting for React Sever to boot up.") | ||
assert_select("meta[http-equiv='refresh']") do |selector, *| | ||
assert_equal("3;URL='/'", selector[:content]) | ||
end | ||
end | ||
|
||
private | ||
|
||
def boot_dummy | ||
Rails.env = "development" | ||
require_relative "../../dummy/config/environment" | ||
end | ||
end | ||
end |
4 changes: 4 additions & 0 deletions
4
gems/quilt_rails/test/dummy/app/controllers/application_controller.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# frozen_string_literal: true | ||
|
||
class ApplicationController < ActionController::Base | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters