dioxus icon indicating copy to clipboard operation
dioxus copied to clipboard

[Bug] Using Context with Suspense Throws a Warning

Open wiseaidev opened this issue 1 year ago • 2 comments

Hiya 👋,

When using the use_context hook in a full-stack setup, I occasionally encounter a warning indicating that the hook is being called twice. It seems this happens because Suspense renders the component twice.

The warning doesn’t appear consistently, but it does pop up often enough to be concerning.

Opening this bug report to track the issue.

Best

wiseaidev avatar Nov 13 '24 11:11 wiseaidev

Calling use_context multiple times when running a component shouldn't cause an issue. Components are supposed to rerun when they need to rerender. Can you provide more details about the issue from the template including:

  1. The version of dioxus you are using
  2. The panic message
  3. The steps to reproduce the issue along with the code

ealmloff avatar Nov 13 '24 15:11 ealmloff

Calling use_context multiple times when running a component shouldn't cause an issue. Components are supposed to rerun when they need to rerender. Can you provide more details about the issue from the template including:

  1. The version of dioxus you are using
  2. The panic message
  3. The steps to reproduce the issue along with the code

Oops, my bad for not including the steps to reproduce (*/ω\) ! It was 3 a.m., and I was deep in the Dioxus rabbit hole. But, AFAIR, I was using use_context, and while poking around in the browser console, I spotted a warning about this issue on Firefox. Next time I run into it, I’ll be sure to update this issue (>ᴗ•)!

wiseaidev avatar Nov 13 '24 17:11 wiseaidev