Skip to content

Commit

Permalink
fix(qwik-city): this for server$ on server
Browse files Browse the repository at this point in the history
fix #5261

Co-authored-by: Wout Mertens <Wout.Mertens@gmail.com>
  • Loading branch information
mhevery and wmertens committed Oct 7, 2023
1 parent 34522a7 commit 6b6192a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/qwik-city/runtime/src/server-functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,12 @@ export const serverQrl: ServerConstructorQRL = (qrl: QRL<(...args: any[]) => any
? (args.shift() as AbortSignal)
: undefined;
if (isServer) {
const requestEvent = useQwikCityEnv()?.ev ?? this ?? _getContextEvent();
const requestEvent = [useQwikCityEnv()?.ev, this, _getContextEvent()].find(
(v) =>
v &&
Object.prototype.hasOwnProperty.call(v, 'sharedMap') &&
Object.prototype.hasOwnProperty.call(v, 'cookie')
);
return qrl.apply(requestEvent, args);
} else {
const ctxElm = _getContextElement();
Expand Down

0 comments on commit 6b6192a

Please sign in to comment.