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

No longer run callable on init #703

Merged
merged 2 commits into from
Feb 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,17 @@ Each tagged version of Datastar is accompanied by a release note. Read the [rele

- Updated Idiomorph to version [0.7.2](https://github.com/bigskysoftware/idiomorph/blob/main/CHANGELOG.md#072---2025-02-20).
- When using `data-bind` on an element, the signal value now defaults to the element’s `value` attribute, provided the signal has not already been defined ([#685](https://github.com/starfederation/datastar/issues/685)).
- The expression passed into `data-on-signals-change` is no longer executed on page load ([#682](https://github.com/starfederation/datastar/issues/682)).
- Whitespace is now maintained in merged fragments ([#658](https://github.com/starfederation/datastar/issues/658)).
- Attribute plugins now define a hash of their contents, preventing duplicate applies ([#691](https://github.com/starfederation/datastar/issues/691)).
- Attribute plugins are now applied to the `html` element instead of the `body` element ([#691](https://github.com/starfederation/datastar/issues/691)).
- Removed Datastar singleton and export functions directly for `setAlias`, `load`, `apply`

### Fixed

- Fixed a bug in which `datastar-remove-fragments` events were not having any effect ([#664](https://github.com/starfederation/datastar/issues/664)).
- Fixed a bug in which `datastarNaN` could be used as an auto-generated element ID ([#679](https://github.com/starfederation/datastar/issues/679)).
- Fixed a bug in which `data-attr` was not removing the element attribute when using object syntax and the value was `false` ([#693](https://github.com/starfederation/datastar/issues/693)).
- Fixed a bug in which `data-attr` was not removing the element attribute when using object syntax and the value was `false` ([#693](https://github.com/starfederation/datastar/issues/693)).

### Removed

- Removed the ability to import the Datastar class. The `setAlias`, `load`, and `apply` functions are exported instead.
2 changes: 1 addition & 1 deletion bundles/datastar-aliased.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions bundles/datastar-aliased.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion bundles/datastar.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions bundles/datastar.js.map

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion library/src/plugins/official/dom/attributes/on.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ export const On: AttributePlugin = {

if (key.startsWith(SIGNALS_CHANGE_PREFIX)) {
if (key === SIGNALS_CHANGE_PREFIX) {
callback()
const signalFn = (event: CustomEvent<DatastarSignalEvent>) =>
callback(event)
document.addEventListener(DATASTAR_SIGNAL_EVENT, signalFn)
Expand Down
4 changes: 2 additions & 2 deletions sdk/go/consts.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions site/static/md/examples/update_signals.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

<pre
class="border-2 border-accent bg-base-200 text-accent text-sm rounded-lg focus:ring-primary focus:border-primary block w-full p-2.5"
data-text="ctx.signals.JSON()"
data-on-signals-change="ctx.el.textContent = ctx.signals.JSON()"
>
Stuff in signals
Expand Down