lukeed / lukeed/preact-cli-ssr

render double html markup or mounted app twice at initial rendering

Open
#7 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
81
Forks
7
PR merge metrics
No merged PRs in 30d

Description

hello sir,
i am working on a project which is based upon this repo I have additional package unistore and i warap it into index.js

`let store = createStore(initialState)
if(typeof window !== "undefined"){
store = (window.__STATE__ && window.__STATE__ !== "==InitialState==") ? createStore(window.__STATE__) : createStore(initialState)
}
const App = ({url, Serverstore}) => {
let Finalstore = (Serverstore && typeof Serverstore !== "undefined") ? Serverstore : store
return(



)
}

export default App`

in my server.js I have added

`let store = createStore(initialState)
let state = store.getState()
let body = render(h(App, {
url: req.url,
Serverstore: store
}))`

initial state on the server side and client side are same. when I run the application on development server it's run smoothly. but when I deploy it on the production server it's inserted client-side app below the SSR markup only on initial rendering when I reload the app double markup removed and run as expected. please help

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by comparing the rendering setup in index.js with the server-side rendering code in server.js, then reproduce the first production load where the app appears below the SSR markup. Check the initial server and client state values and the first mount path; done means the initial page contains only one rendered app and subsequent navigation still works.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
backend, frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.