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

@preact/signals-react-transform unresolved @trackSignals #438

Closed
XantreDev opened this issue Nov 12, 2023 · 2 comments
Closed

@preact/signals-react-transform unresolved @trackSignals #438

XantreDev opened this issue Nov 12, 2023 · 2 comments

Comments

@XantreDev
Copy link
Contributor

If we are using @trackSignals directive - component can be untransformed without aware.
Incorrect:
image
Correct:
image

I think this behaviour will be confusing for transform users, transform should throw error, at least, if cannot handle @trackSignals.

Proposal:

Probably transform can also adapt more common directives pattern: use client, show source, worklet.
Maybe something like use signals.

const Counter = () => {
  'use signals';
  
  return <p>{sig.value}</p>
}

This syntax can be less confusing in terms of components wrapped in hocs

@XantreDev
Copy link
Contributor Author

XantreDev commented Nov 13, 2023

Also I have issue that rollup + esbuild clears this comments while bundling. This can be footgun for library authors
Esbuild is not supporting keeping comments for example: evanw/esbuild#1439

@andrewiggins
Copy link
Member

I believe PR #441 fixes the issue mentioned at the top. Functions wrapped in higher-order functions are supported. For example:

/** @trackSignals */
const C = memo(() => <div>{signal.value}</div>);

If you have an issue/concern with using rollup, etc. let's open a separate issue to discuss that.

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

No branches or pull requests

2 participants