Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion client/invoke.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import deserialize from '../shared/deserialize'
import prefix from '../shared/prefix'
import { symbolHashJoin } from '../shared/symbolHash'
import page from './page'
import worker from './worker'
import client from './client'
Expand All @@ -13,7 +14,7 @@ export default function invoke(name, hash) {
} else {
worker.queues[name] = [...worker.queues[name], params]
}
let finalHash = hash === this.hash ? hash : `${hash}-${this.hash}`
let finalHash = hash === this.hash ? hash : symbolHashJoin(hash, this.hash)
let url = `${worker.api}/${prefix}/${finalHash}/${name}.json`
if (module.hot) {
const version = client.klasses[hash].__hashes[name]
Expand Down
5 changes: 3 additions & 2 deletions server/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import bodyParser from 'body-parser'
import express from 'express'
import path from 'path'
import deserialize from '../shared/deserialize'
import { symbolHashSplit } from '../shared/symbolHash'
import prefix from '../shared/prefix'
import context, { getCurrentContext, generateCurrentContext } from './context'
import emulatePrerender from './emulatePrerender'
Expand Down Expand Up @@ -123,7 +124,7 @@ server.start = function () {
const payload = request.method === 'GET' ? request.query.payload : request.body
const args = deserialize(payload)
const { hash, methodName } = request.params
const [invokerHash, boundHash] = hash.split('-')
const [invokerHash, boundHash] = symbolHashSplit(hash)
const key = `${invokerHash}.${methodName}`
await load(boundHash || invokerHash)
const invokerKlass = registry[invokerHash]
Expand Down Expand Up @@ -154,7 +155,7 @@ server.start = function () {
const payload = request.method === 'GET' ? request.query.payload : request.body
const args = deserialize(payload)
const { version, hash, methodName } = request.params
const [invokerHash, boundHash] = hash.split('-')
const [invokerHash, boundHash] = symbolHashSplit(hash)
let [filePath, klassName] = (invokerHash || boundHash).split("___")
const file = path.resolve('..', filePath.replaceAll('__', '/'))
console.info('\x1b[1;37m%s\x1b[0m', ` [${request.method}] ${request.path}`)
Expand Down
7 changes: 7 additions & 0 deletions shared/symbolHash.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export function symbolHashSplit(hash) {
return hash.split('---')
}

export function symbolHashJoin(hash, joinHash) {
return `${hash}---${joinHash}`
}