Skip to content

Commit 2e554e6

Browse files
committed
Merge pull request #133 from SoonDead/patch-1
Switch the order of server and client-side console.log calls
2 parents b11f198 + 3a8eb4d commit 2e554e6

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/React.Core/ReactEnvironment.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -290,15 +290,16 @@ public virtual IReactComponent CreateComponent<T>(string componentName, T props,
290290
public virtual string GetInitJavaScript()
291291
{
292292
var fullScript = new StringBuilder();
293+
294+
// Propagate any server-side console.log calls to corresponding client-side calls.
295+
var consoleCalls = Execute<string>("console.getCalls()");
296+
fullScript.Append(consoleCalls);
297+
293298
foreach (var component in _components)
294299
{
295300
fullScript.Append(component.RenderJavaScript());
296301
fullScript.AppendLine(";");
297302
}
298-
299-
// Also propagate any server-side console.log calls to corresponding client-side calls.
300-
var consoleCalls = Execute<string>("console.getCalls()");
301-
fullScript.Append(consoleCalls);
302303

303304
return fullScript.ToString();
304305
}

0 commit comments

Comments
 (0)