Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
server.get(`/${key}`, async(req, res) => {
try {
const scope = fork(app)
await allSettled(startServer, {
scope,
params: users[key],
})
const data = serialize(scope)
const content = renderToString()
const result = await compile({content, data})
res.send(result)
} catch (err) {
console.error(err)
res.status(500).send('something going wrong')
}
})
}
import {fork, allSettled} from 'effector/fork'
import {App, app, location$, startClient} from './app'
const history = createBrowserHistory()
location$.updates.watch(location => {
if (history.location !== location) {
history.push(location)
}
})
const clientScope = fork(app, {
values: window.__initialState__,
})
allSettled(startClient, {
scope: clientScope,
params: history,
}).then(() => {
ReactDOM.hydrate(, document.getElementById('root'))
})
import {fork, allSettled} from 'effector/fork'
import {App, location$, startClient} from './app'
import {app} from './domain'
const history = createBrowserHistory()
location$.updates.watch(location => {
if (history.location !== location) {
history.push(location)
}
})
const scope = fork(app, {
values: (window as any).__initialState__,
})
allSettled(startClient, {
scope,
params: history,
})
ReactDOM.hydrate(, document.getElementById('root'))