denoland / fresh

The next-gen web framework.
https://fresh.deno.dev
MIT License
12.25k stars 627 forks source link

Why does/What causes Partials to not work sometimes? #2577

Closed saeho closed 2 days ago

saeho commented 3 months ago

https://github.com/denoland/fresh/assets/9645145/7fa3ba42-c2a6-4471-872f-c62203117c2c

I'm half-certain that this is a Fresh bug, and if it is, then it's related to the other Signal related bug I've been reporting for a while.

As seen in this video, sometimes Fresh routes using Partial works but sometimes it just doesn't. In the video, I click a user's profile which opens a pop over (this is done using Signal, so I predict Signal maybe the cause of this), and then I click "open profile" which routes to a new page. Most of the time this works, but around 40-50% of the time, Partials don't work and the entire page reloads. And as you can see in the video, when I go back and try again, it works, ... until I keep trying and then it fails again. This seems to be very random and unpredictable.

What are some possible causes for this?

Note: I am properly using Partials, and f-client-nav.

marvinhagemeister commented 3 months ago

Thanks for reporting this issue. How can we reproduce it on our machines?

saeho commented 3 months ago

I didn't try to reproduce it yet in a minimal repo, I'll wait for Fresh v2 and see if it fixes it, if not, then I'll try to create a minimal repo like the last bug.

All I know is it's Signal related. All the bugs I reported are Signals related.

I have no issue routing and using the <a href="...">.

But when I try this inside a pop over that was either created by a Signal or a Signal is used on an unmount hook (I am not confirming that Signal clean up hook is the cause for this), that's when I get this bug that happens ~40-50% of the time.

I have a page wrapped in <Partial> and then I have a component created "by" a Signal which is outside the <Partial>. For example, a pop over. The idea of a pop over is that pop over should be "outside" the main page, almost like a React Portal, so Pop Over should belong outside a page/Partial. This seems to be the common denominator.

marvinhagemeister commented 2 days ago

Closing as I'm not sure how to debug this without a reproduction case.