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

docs: add introduction.md #354

Merged
merged 15 commits into from
Feb 4, 2022
Binary file added docs/assets/routes/introduction-demo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/routes/navigation-example.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/routes/navigation-example2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
37 changes: 37 additions & 0 deletions docs/routing/introduction.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Introduction

Most JavaScript frameworks come with a dedicated routing solution
like `angular/router` or `vue-router`. They make it possible to
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
like `angular/router` or `vue-router`. They make it possible to
like `angular/router` or `vue-router`. They allow you to

navigate through different pages of an application without having to
do a full page refresh on every link click.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
navigate through different pages of an application without having to
do a full page refresh on every link click.
navigate through pages of an application without a full page refresh on every click.

Since we no longer have one monolithic application that handles all routes, instead we have several independent applications, we need to solve an important issue, namely routing.
Copy link
Contributor

Choose a reason for hiding this comment

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

  1. Who are 'we'?
  2. Is it necessary to talk about monolith at all?

I would just indicate the current state and why the routing issue still exists in the current state

Copy link
Contributor

Choose a reason for hiding this comment

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

Update:

Problem statement

When you have a monolithic application, it handles all the routes on its own. When there are two or more applications, they also handle all their routes independently. Since, by default, one independent application know nothing about routes and pages of other independent application. This gives you a problem to solve - a routing issue.


The following describes how this is handled in the ILC, but first let's clear up the terminology:

Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
## Routing basics

- Hard transitions - A transition handled by ILC routing, with such a transition, the application on the page changes to another one.
Copy link
Contributor

Choose a reason for hiding this comment

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

In Manning book "Hard transitions" are the ones that cause full page reload. And I think it's counterintuitive to change the meaning of the statement here. As you still need somehow to call transitions with full page reload.

Also you've missed the whole explanation of the App Shell concept (which is basically what ILC does). As well as at least basic explanation of how ILC actually turns hard transitions into "soft ones" by intercepting one events and re-emitting the others....

Another point: there is a nice visualization of Two-level routing (Figure 7.7) in the book. Would be nice to also have it here with all related theory behind it.


- Soft transitions - A transition handled by own routing of some application at the page, with such a transition, only the content inside the application changes.

![Introdaction demo](../assets/routes/introduction-demo.png)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
![Introdaction demo](../assets/routes/introduction-demo.png)
![Introduction demo](../assets/routes/introduction-demo.png)


#
Copy link
Contributor

Choose a reason for hiding this comment

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

What is this?

Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like unnecessary markup


Now, let's talk a little about the theory, after which we will move on to practical examples:

In ILC, we can use one HTML template for all of our applications. With this approach, SSR occurs once when the page is first loaded, then all navigation occurs through CSR. So let's look at navigation in more detail:
Copy link
Contributor

Choose a reason for hiding this comment

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

"we can use one HTML template" - no, we use always one template, and we don't have the capability to change it. Please correct this sentence.


For clarity, here is the routing table:
![Routing table](../assets/routes/route.png)

Let's go to the `/people/` route, it will be a `hard transitions` because we render a new application on the `/people/*` route.

![Navigation example](../assets/routes/navigation-example.png)

Now let's pick someone from the list:

![Navigation example](../assets/routes/navigation-example2.png)

Now our route looks like this: `/people/?selected=4/`, this time it's a `soft transition` because `/?selected=4/` is navigation within the app.

Now let's recap:
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Now let's recap:
Conclusion

Due to the fact that we use one HTML template for all pages, SSR occurs only once, then all navigation happens with the help of CSR and uses both hard and soft transitions, depending on the situation.