Skip to content
This repository was archived by the owner on Mar 20, 2024. It is now read-only.
This repository was archived by the owner on Mar 20, 2024. It is now read-only.

add condition to check that the application root is available in the DOM before prebooting #72

@thaibault

Description

@thaibault

Note: for support questions, please use the Universal Slack Channcel or https://gitter.im/angular/universal

  • I'm submitting a ...
  • bug report
  • feature request
  • Which parts of preboot are affected by this issue?
  • server side
  • client side
  • inline
  • build process
  • docs
  • tests
  • Do you want to request a feature or report a bug?

bug

  • What is the current behavior?

To me it seems there is a big conceptual problem:

Currently the preboot-code is injected into the documents head and waits until document.body evaluates to a positive value (is reachable).
Ok but this does not mean that the entire applications dom is already available:
The body is available before their children (observed in latetest chrome browser: Version 64.0.3282.140 (Developer-Build) (64-Bit)).

<body> <!-- document.body is true before document.querySelect('application') gets a value other than null -->
    <application></application>
</body>

So we will get a "No server node found for selector: ...".

Even if somebody uses the body itself as application's mount point:

<body application></body>
  • We have two bodies (client and server one) during preboot: This may introduces some other problems.
  • We have no switching buffer caused by:
if (!clientView || !serverView || serverView === clientView || serverView.nodeName === 'BODY') {
    return;
}

Don't understand why but you will have your reasons for this condition. The comment "if no client view or the server view is the body or client and server view are the same, then don't do anything and return" only re-describes the code but not why it is necessary.

  • If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem by creating a github repo.

In my optionion there does not actually exists an example where this lib works without any monkey patches (no buffer switch or "No server node found ..." issue).

  • What is the expected behavior?

This lib should start recording events right after the application's dom is available. In my optinion this would only work if we inject the preboot code right after the applications root dom node (mountpoint). Maybe we would have an application specific preboot code.

  • What is the motivation / use case for changing the behavior?

Making this library and cool idea work.

  • Please tell us about your environment:
  • Browser: [Chrome 64]
  • Language: [TypeScript X.X | ES6/7]
  • OS: [Linux]
  • Platform: [NodeJs|Chrome]

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions