Skip to content

Conversation

JoviDeCroock
Copy link
Member

Fixes #422

Copy link

changeset-bot bot commented Aug 6, 2025

🦋 Changeset detected

Latest commit: e7d241c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
preact-render-to-string Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Comment on lines 746 to 748
function isSignal(x) {
return x instanceof Signal;
}
Copy link
Member

Choose a reason for hiding this comment

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

Wondering if we should use duck-typing here like https://github.com/denoland/fresh/blob/e65643c482de9b5afee5d52af3ccc88941c35b5c/src/runtime/server/preact_hooks.tsx#L355-L362 . That way we can keep rts dependency free and don't have to keep it in sync with major @preact/signals version increases.

Copy link
Member Author

Choose a reason for hiding this comment

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

This might end up being a much larger perf hit in the critical path though

Copy link
Member

Choose a reason for hiding this comment

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

Not sure if x !== null && typeof x === "object" is more or less expensive than an instanceof check. I let you decide on that one.

Copy link
Member

@rschristian rschristian Aug 6, 2025

Choose a reason for hiding this comment

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

I'd rather avoid adding a dep for a singular instanceof check myself, and at least as of a few years ago, duck-typing with 1-2 properties usually outperformed instanceof in Chrome. No idea of what fully happens internally there, but naively, makes sense to me.

If you've measured it & it is a perf issue, fair enough of course. I'll have some time in a bit to check the benches (if you haven't already).

Edit: At least on my system, the check Marvin linked to above doesn't seem to perform any worse than instanceof. Ran the benches a few times and there wasn't any noticeable drop.

Copy link
Member

@marvinhagemeister marvinhagemeister left a comment

Choose a reason for hiding this comment

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

LGTM

@marvinhagemeister marvinhagemeister merged commit 4a8d4a0 into main Aug 8, 2025
1 check passed
@marvinhagemeister marvinhagemeister deleted the fix-signals-support branch August 8, 2025 12:21
@github-actions github-actions bot mentioned this pull request Aug 8, 2025
@hronro
Copy link

hronro commented Aug 14, 2025

It's great to see this has been merged! Are there any plans to release a new version that includes this fix?
@JoviDeCroock @marvinhagemeister

@rschristian
Copy link
Member

rschristian commented Aug 14, 2025

We'll release it when we're ready, please be patient.

You can use patch-package or pnpm patch in the meantime if you need it, should be pretty straightforward to add.

SVG_CAMEL_CASE,
createComponent
} from './lib/util.js';
import { Signal } from '@preact/signals-core';
Copy link
Member

Choose a reason for hiding this comment

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

Looks like this was accidentally left around, will need to be removed but I gotta get to bed -- I can do it tomorrow but wanted to drop a mention at least so we don't release this.

@hronro
Copy link

hronro commented Aug 14, 2025

We'll release it when we're ready, please be patient.

You can use patch-package or pnpm patch in the meantime if you need it, should be pretty straightforward to add.

Thanks for your reply. I'm using Deno with the Fresh framework, which isn't easy to patch a npm dependency, neither pactch-package nor pnpm patch works for me. Anyway, I appreciate the work you guys have done and hope there could be a new release soon.

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.

Not working properly when using signals on "disabled" attribute

4 participants