Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Output from console.log during SSR is not reset between requests #1237

Open
4 tasks done
LinusCenterstrom opened this issue Jan 26, 2021 · 2 comments · May be fixed by #1288
Open
4 tasks done

Output from console.log during SSR is not reset between requests #1237

LinusCenterstrom opened this issue Jan 26, 2021 · 2 comments · May be fixed by #1288
Assignees

Comments

@LinusCenterstrom
Copy link

Thanks for filing a bug! To save time, if you're having trouble using the library, please check off the items you have tried. If you are just asking a question, skip right to the bottom.

Please verify these steps before filing an issue, and check them off as you go

  • The relevant native JavascriptEngineSwitcher library packages are installed (such as JavaScriptEngineSwitcher.V8.Native.win-x64)
  • The VC++ 2017 runtime is installed
  • The value of SetUseReact and SetUseBabel is correct in ReactConfig.cs or Startup.cs
  • I've looked at the sample projects in this repo to verify that my app is configured correctly

I'm using these library versions:

  • ReactJS.NET: 5.0.0

Steps to reproduce / description

make sure to enable reuse of javascript engines.
SetReuseJavaScriptEngines(true)

render a simple component that logs something.

function Comp(){
     console.log("test");
     return <div>Hello World!</div>;
}

and refresh the page a few times.
You'll notice you get one more console.log for each page refresh. (Until the javascript engine is reset)

Suggested fix: Either expose a method that resets the console calls array or you could just make console.getCalls empty the array of calls, since I don't see a situation where you'd want to get the same calls more than once.

@cb-eli
Copy link

cb-eli commented Aug 24, 2021

Happened to me as well... even when the component called console.log is not rendered in the next requests, the console.log message still appears.

@Daniel15
Copy link
Member

Hmmm... It's likely that this has been a problem ever since engine pooling was added to the library. The data stored in the log shim needs to be cleared after the request.

@Daniel15 Daniel15 self-assigned this Aug 25, 2021
@LinusCenterstrom LinusCenterstrom linked a pull request Apr 1, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants