rrit
(Ayke)
February 7, 2022, 8:33pm
14
Feature flag is implemented.
I’m not at all a ruby developer - on this I definitely need some help.
Maybe push my POC into a new branch in the discourse/discourse repo, before doing a PR on main
?
This is my PR on this feature:
discourse:main
← rr-it:dev/javascript-defer
opened 03:49AM - 08 Feb 22 UTC
Implement experimental feature flags for "static topic content" and " javascript… defer"
### static topic content
`SiteSetting.enable_experimental_static_topic_content`
Can be set via settings dashboard.
Show static content in topic view for a faster Largest Contentful Paint (LCP).
Warning: visitors might see disconcerting jumping of content!"
### javascript defer
`SiteSetting.enable_experimental_javascript_defer`
Can be set via settings dashboard.
Defer loading of JavaScripts to show static content even faster in combination with 'enable_experimental_javascript_defer'. Warning: the discourse frontend, themes, components and/or plugins might fail!
---
The vendor-javascript and all preceding javascripts are not deferred right now.
@see: https://github.com/rr-it/discourse/commit/49405c353a31180933aed9dca7697dce05227707
Ideas on how to solve this are very welcome.
---
For more information see also:
https://meta.discourse.org/t/defer-javascript-and-show-interim-content-on-initial-page-load/216458
@david Can you lend me your head for some help on developing Rspec tests for these changes:
app/helpers/application_helper.rb : spec/helpers/application_helper_spec.rb
I don’t see feasible unit tests here. It looks testable by integration tests only.
app/models/theme.rb
app/models/theme_field.rb
I had to disable defer tag for QUnit Test Runner: app/views/qunit/index.html.erb
Before QUnit Tests did still run with the feature flag "javascript defer" = false
. And now the tests run also with "javascript defer" = true
.
2 Likes