Git Product home page Git Product logo

Comments (15)

yisar avatar yisar commented on May 14, 2024

How about 1.8.3

from fre.

mindplay-dk avatar mindplay-dk commented on May 14, 2024

How about 1.8.3

All versions after 1.8.1 affect that example.

Here's another simpler example:

https://codesandbox.io/s/fre-demo-uxuic

This one starts to break with version 1.8.0 already, so the bug may have been partially introduced there.

Watch:

bug

All of a sudden, it's like the scheduler stops accepting new tasks or something?

If you look in the console, you can see event handlers are still firing - it's the calls to the useState setters that aren't triggering updates.

Could be related to this maybe?

from fre.

yisar avatar yisar commented on May 14, 2024

This looks like 1.8.0 is wrong, in version 1.8.3 I removed [] and it worked

const component = useMemo(() => new Component(props));

from fre.

mindplay-dk avatar mindplay-dk commented on May 14, 2024

Okay, we still have missing tests for useEffect with different deps arguments - all the tests use an array right now. If this is the problem, I guess that's why the tests didn't catch it.

That might explain the problem with the first example.

But according to useMemo docs:

If no array is provided, a new value will be computed on every render.

That's not what I want in the first example - I'm passing [] because the function has no dependencies and should be executed only on the first render.

And the second example? The error is periodic, as you can see in the GIF - so probably has something to do with the scheduler? Might be two separate problems.

Gotta get the rest of the tests in place...

from fre.

yisar avatar yisar commented on May 14, 2024

I'm sorry, your code is correct, I just debugged it, this is indeed my fault, I will fix it as soon as possible, thanks!

from fre.

mindplay-dk avatar mindplay-dk commented on May 14, 2024

Okay, cool - I'll try to get the missing coverage for hooks today, so we can make sure this stuff doesn't break again 🙂

from fre.

yisar avatar yisar commented on May 14, 2024

It seems that I have fixed this bug, and then it should be #80

from fre.

mindplay-dk avatar mindplay-dk commented on May 14, 2024

I'm sorry, I think you misunderstood.

The test was correct - it failed because the effects weren't being triggered correctly.

image

Now the test is wrong: the same cleanup and effects should not execute more than once!

from fre.

yisar avatar yisar commented on May 14, 2024

Can you give me an example with sandbox? the test I am not sure weather it is correct.

from fre.

yisar avatar yisar commented on May 14, 2024

In fact, the bug here has nothing to do with useeffect, but all my debugging results are the same as react. I need an example to show the difference between react and fre, not the document or the test ,Thank you very much

from fre.

yisar avatar yisar commented on May 14, 2024

Let me explain again. I'm not sure whether the test case is correct or not, but I won't say it's wrong. I have to get an example that can be debugged, or I will maintain the status quo. If the example proves my mistake, it's not difficult to fix it, please forgive me.

from fre.

mindplay-dk avatar mindplay-dk commented on May 14, 2024

I have to get an example that can be debugged, or I will maintain the status quo.

That's what the tests are for 😉

I guess from the HTML files in the demo folder that you're debugging from an HTML page in a browser?

When you run the tests under node, you can connect (for example from VS Code or WebStorm, whatever you're using) to the debugger, set breakpoints, inspect variables, run individual tests with a click, and so on - it's definitely worth learning. 🙂

from fre.

mindplay-dk avatar mindplay-dk commented on May 14, 2024

With your last commit, I can confirm that my sandbox example is now working correctly!

It took me a while to figure out why the test is passing with your change - it looks wrong, but now I see the error in my test! PR on the way! 😁

from fre.

mindplay-dk avatar mindplay-dk commented on May 14, 2024

For the record, the weird problem I showed above where the scheduler seemed to die - this also no longer seems to occur, so these were probably related. 👍

from fre.

yisar avatar yisar commented on May 14, 2024

I published v1.8.5👏

from fre.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.