solid icon indicating copy to clipboard operation
solid copied to clipboard

Uncaught Error after enabling scheduling

Open thetarnav opened this issue 3 years ago • 5 comments

Describe the bug

I have tried enabling the scheduling in the solid implementation of the last UI benchmark: https://github.com/uhyo/ui-library-benchmark.

import { enableScheduling } from "solid-js"
enableScheduling()

But it broke the application — after I tried to type in the input, the console was spammed by this error:

image

I've recreated the breaking benchmark here: https://stackblitz.com/edit/vitejs-vite-srnwbb?file=src%2Findex.tsx

This demo seems to be working fine though after updating: https://codesandbox.io/s/scheduling-circles-w-slowdown-forked-99l9g7?file=/index.js

Your Example Website or App

https://stackblitz.com/edit/vitejs-vite-srnwbb?file=src%2Findex.tsx

Steps to Reproduce the Bug or Issue

  1. Try typing in the input
  2. Open the console to see errors

Expected behavior

Calling enableScheduling shouldn't break the application.

Screenshots or Videos

No response

Platform

  • OS: Windows
  • Browser: Chrome, Opera
  • Version: 1.4.7

Additional context

No response

thetarnav avatar Jul 16 '22 10:07 thetarnav

Minimal reproduction: https://playground.solidjs.com/?hash=-2045179172&version=1.4.1

This should be more consistent than the one I posted on discord a few days ago, hopefully.

  1. Click button
  2. Read console

  • OS: Windows 10
  • Browser: Edge, Chrome, Firefox

otonashixav avatar Jul 16 '22 14:07 otonashixav

Yeah, I see it. It's mechanical. My mechanism for doing sub chains involves resetting the queue, and banking on the next write to do an independent update. But we also queue creation here; in this case, the queue isn't defined as it isn't in a write. Need to rethink the approach slightly.

ryansolid avatar Jul 18 '22 05:07 ryansolid

Hi! I've faced the similar issue when I tried to enableScheduling in my project with solid-app-router. I've decided to do it after I watching your stream, @ryansolid, but I didn't find any documentation describing this function. I've checked its source code though. So I have two questions:

  1. Do I understand it right that without calling this function concurrent rendering isn't working and transitions are useless?
  2. Is there any legal fix to this issue?)

TrueMrMaverick avatar Jul 18 '22 15:07 TrueMrMaverick

  1. No. This is like the 2% use case from my perspective, which is why I put it behind a flag. Transitions work great for common things like navigation and IO. enableScheduling is only for the case in which synchronous work is too expensive. I've never come across this naturally in Solid. Only in benchmarks that simulate slowdown. Which is sort of the problem because I only can build/test against these. So this has been considered a "experimental" feature and why it isn't documented. I built this feature under benchmarks, benchmarks that mostly update rather than create and I never saw this issue.

Without scheduling Transitions have a ton of use for navigation and ensure async consistent UIs. I never felt we needed concurrent rendering for performance. Frameworks like Vue and Preact decided it isn't even worth considering for that reason. I think the UX win is worth it regardless.

  1. This is issue is fixable but it is something I need to fix in core. Expect a fix as part of the 1.5 release coming out in the next weeks.

ryansolid avatar Jul 18 '22 17:07 ryansolid

I was just looking at this benchmark, to try to determine desired behavior and it is super buggy. Every implementation does different things and even React crashes on certain DOM operations. I'm having a hard time figuring out where the issues are. I fixed the error but it doesn't seem to be working. I will dig further.

Edit: nvm it was google translate messing with things.

ryansolid avatar Aug 02 '22 07:08 ryansolid