Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CORE: disable the requirement for having a url, when enabling renderNow in Renderer #9769

Merged
merged 2 commits into from
Apr 13, 2023
Merged
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
3 changes: 2 additions & 1 deletion src/Renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export function Renderer(options) {
this.config = config;
this.handlers = {};
this.id = id;
this.renderNow = renderNow;

// a renderer may push to the command queue to delay rendering until the
// render function is loaded by loadExternalScript, at which point the the command
Expand Down Expand Up @@ -110,7 +111,7 @@ Renderer.prototype.process = function() {
* @returns {Boolean}
*/
export function isRendererRequired(renderer) {
return !!(renderer && renderer.url);
return !!(renderer && (renderer.url || renderer.renderNow));
}

/**
Expand Down
3 changes: 1 addition & 2 deletions test/spec/renderer_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ describe('Renderer', function () {
expect(testRenderer2.getConfig()).to.deep.equal({ test: 'config2' });
});

it('sets a render function with setRender method', function () {
it('sets a render function with the setRender method', function () {
testRenderer1.setRender(spyRenderFn);
expect(typeof testRenderer1.render).to.equal('function');
testRenderer1.render();
Expand Down Expand Up @@ -110,7 +110,6 @@ describe('Renderer', function () {

it('renders immediately when requested', function () {
const testRenderer3 = Renderer.install({
url: 'https://httpbin.org/post',
config: { test: 'config2' },
id: 2,
renderNow: true
Expand Down