question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Imports in documentation for Signals

See original GitHub issue

I noticed a possible minor issue with the documentation for Signals.

In some examples on the page, imports look like this:

import { signal, computed } from "@preact/signals";

In some later examples on the same page, instead imports look like this:

import { signal, computed, effect } from "@preact/signals-core";

The switch from @preact/signals to @preact/signals-core doesn’t seem to be explained in the text.

Presumably @preact/signals-core is the stuff that’s generic and shared with the React implementation?

And @preact/signals is the Preact-specific implementation?

So I’m not grasping why you would switch between these in the examples.

(note also that @preact/signals-core was published without a README.)

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
rschristiancommented, Oct 10, 2022

Perhaps that’s some poor naming, indeed. I’m not a huge fan of splitting up the content (we don’t really do that for any other topic) but maybe that’s what we need to do.

There’s also the question of whether signals-core should be covered in Preact’s docs at all (from the Preact team, but not necessarily relevant to someone looking to use Preact + its addons) but I don’t have a great answer for that at the moment either.

Will definitely be thinking about this though, maybe there’s a way to restructure some of our content that’ll fit this sort of situation better. I think our current set up does make it a bit difficult to differentiate what’s from the team and what’s meant to be used with Preact itself.

0reactions
mindplay-dkcommented, Oct 10, 2022

Okay, that’s a bit confusing. But yes, I understand now that these examples are not in fact about Preact - they’re about using Signals independently of Preact.

Perhaps this section should be migrated to a separate page under “Advanced”? With a link from where it is now.

The title “Advanced signals usage” does make it seem out of place in the “Essentials” section, I think.

Read more comments on GitHub >

github_iconTop Results From Across the Web

signal — Set handlers for asynchronous events ... - Python Docs
The signal.signal() function allows defining custom handlers to be executed when a signal is received. A small number of default handlers are installed: ......
Read more >
Signals - Django documentation
To receive a signal, register a receiver function using the Signal.connect() method. The receiver function is called when the signal is sent. All...
Read more >
Signals — tool v0.5.0 documentation - PythonHosted.org
Decorator, connects given function to given signal. Semantic sugar for PyDispatcher's connect. Usage: from tool.signals import called_on @ ...
Read more >
Signals — CKAN 2.11.0a0 documentation
Signal subscribers MUST always be defined as callable accepting one mandatory argument sender and arbitary number of keyword arguments: def subscriber(sender, ...
Read more >
Signals — Flask Documentation (1.1.x)
Signals help you decouple applications by sending notifications when actions ... from flask import template_rendered from contextlib import contextmanager ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found