Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • J js-stack-from-scratch
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 39
    • Issues 39
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 9
    • Merge requests 9
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Verekia
  • js-stack-from-scratch
  • Issues
  • #224
Closed
Open
Issue created May 28, 2017 by Jerry Green@jerrygreen

[Clarification] Doubling of code of requests?

Type of issue: Clarification of architecture

I really like the idea of js-stack-from-scratch and js-stack-boilerplate but I found 1 interesting thing. Why server rendered data differs from client rendered data?

Let's say we want to get list of posts. How do I make requests to API server in old SPA world without SSR? (simplified version)

  1. I have an dispatch in componentDidMount, which triggers an actions, which triggers a saga, which makes an API fetch call, so I get the posts. Yahoo!

How do I make requests to API server in new SPA world with SSR?

  1. I have an dispatch in componentDidMount, which triggers an actions, which triggers a saga, which makes an API fetch call, so I get the posts. Yahoo!
  2. I found such thing as a controller.js which makes the same API call correspond to the component to preload global state. Huh?

Do I misunderstand somewhat? Why do we do it twice? Did you think about it?

Assignee
Assign to
Time tracking