Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 0 additions & 54 deletions .github/workflows/lint-js-and-ruby.yml

This file was deleted.

3 changes: 1 addition & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ jobs:
matrix:
ruby: [2.7]
node: [14]
rake_task: ['run_rspec:all_but_examples', 'run_rspec:examples']
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
Expand Down Expand Up @@ -160,7 +159,7 @@ jobs:
- name: generate file system-based packs
run: cd spec/dummy && RAILS_ENV=test bundle exec rake react_on_rails:generate_packs
- name: Main CI
run: bundle exec rake ${{ matrix.rake_task }}
run: cd spec/dummy && bundle exec rspec spec/system/integration_spec.rb
- name: Store test results
uses: actions/upload-artifact@v2
with:
Expand Down
35 changes: 0 additions & 35 deletions .github/workflows/package-js-tests.yml

This file was deleted.

46 changes: 0 additions & 46 deletions .github/workflows/rspec-package-specs.yml

This file was deleted.

2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Changes since last non-beta release.
### [13.3.3] - 2022-03-21

### Fixed
- Fixed bug regarding loading FS-based packs. [PR 1527](https://github.com/shakacode/react_on_rails/pull/1527) by [judahmeek](https://github.com/judahmeek)
- Fixed bug regarding loading File-System based packs. [PR 1527](https://github.com/shakacode/react_on_rails/pull/1527) by [judahmeek](https://github.com/judahmeek)

### [13.3.2] - 2022-02-24

Expand Down
7 changes: 7 additions & 0 deletions node_package/src/ComponentRegistry.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import type { RegisteredComponent, ReactComponentOrRenderFunction, RenderFunction } from './types/index';
import isRenderFunction from './isRenderFunction';

function logRegisteredComponents(value: string, key: string) {
console.warn(key);
}

const registeredComponents = new Map();

export default {
Expand All @@ -17,6 +21,7 @@ export default {
if (!component) {
throw new Error(`Called register with null component named ${name}`);
}
console.warn("registering ".concat(name, " component"));

const renderFunction = isRenderFunction(component);
const isRenderer = renderFunction && (component as RenderFunction).length === 3;
Expand All @@ -27,6 +32,8 @@ export default {
renderFunction,
isRenderer,
});

registeredComponents.forEach(logRegisteredComponents)
});
},

Expand Down
5 changes: 4 additions & 1 deletion node_package/src/clientStartup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ export function reactOnRailsPageLoaded(): void {
context.roots = [];
}
forEachStore(context, railsContext);
console.warn("RoR components are now being rendered.");
forEachReactOnRailsComponentRender(context, railsContext);
}

Expand Down Expand Up @@ -309,9 +310,11 @@ export function clientStartup(context: Context): void {
// but sub-resources such as images, stylesheets and frames are still loading.
// If lazy asynch loading is used, such as with loadable-components, then the init
// function will install some handler that will properly know when to do hyrdation.
if (document.readyState !== 'loading') {
if (document.readyState == 'complete') {
console.warn("renderInit used with setTimeout")
window.setTimeout(renderInit);
} else {
console.warn("renderInit used with eventListener")
document.addEventListener('DOMContentLoaded', renderInit);
}
}
2 changes: 1 addition & 1 deletion spec/dummy/app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<%= yield :head %>

<!-- NOTE: Must use defer and not async to keep async scripts loading in correct order -->
<%= javascript_pack_tag('client-bundle', 'data-turbolinks-track': true, defer: false) %>
<%= javascript_pack_tag('client-bundle', 'data-turbolinks-track': true, defer: true) %>

<%= csrf_meta_tags %>
</head>
Expand Down
2 changes: 1 addition & 1 deletion spec/dummy/config/initializers/react_on_rails.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,5 @@ def self.adjust_props_for_client_side_hydration(component_name, props)
config.rendering_props_extension = RenderingPropsExtension
config.components_subdirectory = "startup"
config.auto_load_bundle = true
config.defer_generated_component_packs = false
# config.defer_generated_component_packs = false
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commented out should be the default with an explanation of why change this. Typically, that is b/c we're loading jQuery and inline HTML scripts need the JS code loaded first.

end
2 changes: 1 addition & 1 deletion spec/dummy/spec/helpers/react_on_rails_helper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class PlainReactOnRailsHelper
allow(helper).to receive(:append_javascript_pack_tag)
allow(helper).to receive(:append_stylesheet_pack_tag)
expect { helper.load_pack_for_generated_component("component_name") }.not_to raise_error
expect(helper).to have_received(:append_javascript_pack_tag).with("generated/component_name", { defer: false })
expect(helper).to have_received(:append_javascript_pack_tag).with("generated/component_name", { defer: true })
expect(helper).to have_received(:append_stylesheet_pack_tag).with("generated/component_name")
end
end
Expand Down
5 changes: 3 additions & 2 deletions spec/dummy/spec/system/integration_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -207,17 +207,18 @@ def finished_all_ajax_requests?
end
end

describe "Manual client hydration", :js, type: :system do
describe "Manual client hydration", :js, :focus, type: :system do
before { visit "/xhr_refresh" }

it "HelloWorldRehydratable onChange should trigger" do
it "HelloWorldRehydratable should register" do
within("form") do
click_button "refresh"
end
wait_for_ajax
within("#HelloWorldRehydratable-react-component-1") do
find("input").set "Should update"
within("h3") do
page.driver.browser.logs.get(:browser).each { |log| puts log }
expect(page).to have_content "Should update"
end
end
Expand Down