Skip to content
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

Add features: createRoot, PromiseWrapper, and react lazy #587

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

evbo
Copy link

@evbo evbo commented Aug 11, 2022

Hi,

I am very short on time and had to "throw this over the wall" but here are 3 very important React features I'm using for my own needs:

  1. createRoot is the new alternative to ReactDOM.render and if not used will limit React features to version 16
  2. PromiseWrapper is a convenient helper utility to use Suspense for experimental data fetching from any arbitrary source
  3. React Lazy lets you lazy load modules for Suspense

A lot of testing is needed and code cleanup. I am hoping the Slinky community is patient with these WIP changes and is willing to help out a bit too. I will try to support more in time but I wanted to initiate the PR just to get the ball rolling with at least baseline functionality.

Thanks!

… but work in my own use cases. Much polish is still needed and help wanted.
@evbo
Copy link
Author

evbo commented Aug 12, 2022

addresses: #196

@shadaj
Copy link
Owner

shadaj commented Aug 15, 2022

Thanks for the PR @evbo! This will be a great starting point for getting Slinky up to speed with the latest React features.

In the near future, would you be able to fix some of the formatting issues? That way we can get this merged and start working on followup testing.

@shadaj shadaj added this to the v0.7.3 milestone Aug 15, 2022
@DamianReeves
Copy link

Wondering what needs to be done to get this in


class PromiseWrap[T](suspend: Future[T]) extends js.Object {
private val pending = suspend.toJSPromise
private var data: Option[T] = None
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this shouldn't be private as I'm finding often non-presentational logic may want to check the existence of data without triggering unnecessary exceptions to be thrown

@evbo
Copy link
Author

evbo commented Dec 20, 2022

Wondering what needs to be done to get this in

I pretty much just threw the code over the wall, missing some unit testing opportunities, code cleanliness here and there. I left a comment with the only functional change I would still make.

@shadaj shadaj modified the milestones: v0.7.3, v0.7.4 Dec 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants