-
-
Notifications
You must be signed in to change notification settings - Fork 97
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
Example code not working #333
Comments
Further exploration leads me to see that using the signal variable it's self works and updates but using Works:
Doesn't work:
in the above use-case, this is fine but for objects I don't really see a way around not using value and thus why I think the example is failing. |
For the REPL not working, see: preactjs/preact-www#978. It's a recent bug in the REPL, it'll (hopefully) get fixed shortly. Are you using React or Preact? Might be a duplicate of #298 if the former. |
@rschristian thanks for the response. I am using react and I hadn't seen that bug previously and made the changes to test. I still can not get a signal with an object to re-render. In the below example the incrementation will happen but wont show until I cause a rerender by other means.
|
It may be of value to know that this is a vite project using the |
Here's an update example (https://codesandbox.io/s/react-playground-forked-8d9yi5?file=/index.js) if you increment counter it works. If you increment the complexSignal it works without re-render. Then go increment counter again and you'll see on re-render the incremented complexSignal is correct |
In your example you aren't updating the signal, but a property of the object of the signal. You will also need to make sure that your I updated your example to work with these limitations: https://codesandbox.io/s/react-playground-forked-hmbk8t?file=/index.js |
@Kanaye thanks so much. I just found this chain of comments as well that help: #120 (comment) |
Going to close this out then, you can subscribe to the linked issues to get updates on them. Feel free to ping if you run into any other issues. |
I couldn't get rerenders working on a test scenario I created so I re-read the docs and found the signals demo. That also doesn't appear to work/re-render. Anyone know what's going on? https://preactjs.com/repl?example=todo-list-signals
The text was updated successfully, but these errors were encountered: