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

Inject data only when renders via Meteor #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Inject data only when renders via Meteor #2

wants to merge 1 commit into from

Conversation

timbrandin
Copy link

Look for text/html in the content type on the request to better decide when to inject fast render data.

@@ -26,7 +26,8 @@ http.OutgoingMessage.prototype.write = function(chunk, encoding) {
var condition =
this._injectPayload && !this._injected &&
encoding === undefined &&
/<!DOCTYPE html>/.test(chunk);
/<!DOCTYPE html>/.test(chunk) &&
/Content-Type: text\/html/.test(this._header);
Copy link
Member

Choose a reason for hiding this comment

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

Is this correct? Seems bit confusing to me?

Copy link
Author

Choose a reason for hiding this comment

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

I know, a bit odd. But it works with SSR with _escaped_fragment_ this way.

@arunoda
Copy link
Member

arunoda commented May 1, 2015

I've another suggestion to make this work.

  • List add a meta tag to the HTML page via this package (means simply add .html file)
  • Then let's check whether that exists or not
  • If that's exists, it's rendered via Meteor

Does that suits with your use case?

@timbrandin
Copy link
Author

Oh, yeah that would work. I guess in my use case I'm still rendering via Meteor but don't want the big script tag for _escaped_fragment_ requests.

@timbrandin
Copy link
Author

I wonder if you get the script tag on SSR for E-mail too?

@arunoda
Copy link
Member

arunoda commented May 1, 2015

Okay. Then let's do a check for the URL for _escaped_fragment_ too.

@timbrandin
Copy link
Author

The URL doesn't seem to be available in the current context. Any ideas?

@arunoda
Copy link
Member

arunoda commented May 1, 2015

Yes. Then let's do that check in the fast-render.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants