Skip to content

Large cleanup

Latest

Choose a tag to compare

@Gozala Gozala released this 03 Jul 22:37
· 24 commits to master since this release

Upgrade to flow@0.49

Switched to flow syntax

New version no longer uses flow comment and separate .js.flow files for interface definitions. Instead interface definitions have moved to same named .js files and standard type syntax is used for type annotations.

Switched to never type

flow@0.34 introduced empty as a "bottom type" that actually does what our custom Never type used to do. This release removes Never in favor of empty.

Better code coverage

In this release flow code coverage has being greatly improved so expect a lot more errors cough than in older versions.

Driver interface moved to reflex-driver

In this release driver interface got greatly simplified to reduce requirements for the driver implementer. In addition built-in driver got replaced by one that just throws exception if used, this would make sure that built-in driver isn't used initially and then re-rendered with actual driver. This implies that you can't create nodes outside of the view function, but given that it greatly simplifies API we decided it was worth it. If you do happen to create nodes outside of regular application loop, you still can do that but instead you'd have to create those with a actual driver instead of API exposed by reflex.

node got renamed to element

In the past reflex referred to elements nodes as nodes and to nodes as virtual nodes it also enforced very specific interface for every node type. In this release reflex no longer distinguishes between node types, but functions node got renamed to element for more clarity.

A Farewell to FRP

In this release we're finally catching up with Elm making signals unnecessary (Linked article does a great job explaining why). In this release reflex no longer has notion of signals and all of the associated constructs had being removed.

Simpler application bootstrap

Removal of signals required a breaking API change as signal subscriptions used to be a way to wire DOM and Effect drivers:

import {init, update, view} from "./main"
import {start, Effects} from "reflex"
import {Renderer} from "reflex-virtual-dom-driver"

const rederer = new Renderer({ target: document.body })
const app = start({ init, update, view })
app.view.subscribe(renderer.address)
app.task.subscribe(Effects.driver(app.address))

API that replaced it is as follows:

import {init, update, view} from "./main"
import {start, Task} from "reflex"
import {Renderer} from "reflex-virtual-dom-driver"

const rederer = new Renderer({ target: document.body })
const app = start({ init, update, view }, ({view, task}) => {
  renderer.render(view)
  Task.perform(task)
})

Experimental support for subscriptions

This release contains experimental and undocumented support for subscriptions which were a major missing piece from Elm. Unlike subscriptions Elm, reflex will have no special "effect manager" modules that get wired up at compile time, instead there will be notion of services that have API somewhat similar to application (but without view) that components will be able to subscribe to. For this reason we'll take few more cycles to iron out the API before finalizing it. So if you want to play and provide feedback, feel free otherwise wait until they're fully baked.