Releases: hyperstack-org/hyperstack
Releases · hyperstack-org/hyperstack
alpha 1 milestone towards 1.0 release
- all public module and class names updated and consistent - EXCEPT HyperModel
- applications should now create a HyperComponent wrapper class (like ApplicationRecord)
- public APIs are updated, consistent and stable
- many previously deprecated features are now removed
- state management is greatly simplified and 25X faster
- all state and params are kept in regular ruby instance variables
- automatic unmounting of
every, after, and receives
when owning components unmount - react
dom
keyword which creates jQuery object from refs. set
method to interface between reactref
, hyperstackdom
, and promises.- you can use the
render
method inside of router classes instead ofrouter
.
Until alpha2 (or later) HyperModel still monkey patches ActiveRecord. Eventually HyperModel will be presented as include modules that you add to ApplicationRecord. But not yet.
To upgrade from Hyperloop 0.99:
- make sure you have resolved any deprecation notices first.
- update your
Gemfile
:
2.1 usegem 'rails-hyperstack', '~> 1.0.alpha'
instead ofgem 'hyperloop'
2.2 removegem 'opal_hot_reloader'
(its built in)
2.3 updategem 'hyper-spec'
, '~> 1.0.alpha1.1'
2.4 removegem 'hyper-console'
(not yet supported) - rename the
app/hyperloop
directory toapp/hyperstack
- change
Hyperloop
toHyperstack
in your policy files. - update your hyperloop initializer file:
5.1 change the module name fromHyperloop
toHyperstack
5.2 remove theconfig.import 'reactrb/auto-import
line.
5.2 replaceconfig.import 'opal-jquery', client_only: true
with
config.import 'hyperstack/component/jquery'
if you use jquery.
5.3 removeconfig.import 'react/ext/opal-jquery/element', client_only: true
if present.
5.4 if you are using the hot loader, replaceconfig.import 'opal_hot_reloader',
with
config.import 'hyperstack/hotloader', client_only: true if Rails.env.development?
- update your application.js/rb file:
6.1 replace//= require hyperloop-loader
with//= require hyperstack-loader
6.2 removeOpal.OpalHotReloader.$listen()
- its built in now, and be configured in the hyperstack initializer. - change the
hot-loader
entry in your Procfile to readhot-loader: bundle exec hyperstack-hotloader -d app/hyperstack
- in your routes file change
Hyperstack
toHyperstack
andhyperloop
tohyperloop
for example a basic routes file should look like this:
Rails.application.routes.draw do
mount Hyperstack::Engine => '/hyperstack'
get '/(*other)', to: 'hyperstack#app'
end
- add a migration -
rails g migration DropHyperloopTables
- with these contents:
class DropHyperloopTables < ActiveRecord::Migration[5.2]
def change
drop_table :hyperstack_connections
drop_table :hyperloop_connections
drop_table :hyperstack_queued_messages
drop_table :hyperloop_queued_messages
end
end
- add these definitions in your components directory:
# app/hyperstack/components/_hyperloop_legacy_definitions.rb
module Hyperloop
class Component
include Hyperstack::Component
include Hyperstack::Legacy::Store
param_accessor_style :legacy
end
class Router < Component
def self.inherited(child)
child.include Hyperstack::Router
end
class Component < Hyperloop::Component
def self.inherited(child)
child.include Hyperstack::Router::Helpers
end
end
end
class Store
include Hyperstack::Legacy::Store
end
end
module HyperRouter
module ComponentMethods
def self.included(base)
base.include Hyperstack::Router::Helpers
end
end
end
- so you can incrementally upgrade your components to Hyperstack syntax, you will also want to define an application component base class like this:
# app/hyperstack/components/hyper_component.rb
class HyperComponent
include Hyperstack::Component
include Hyperstack::State::Observer
end
Make sure you do a bundle install
, and then rm -rf tmp/cache
.
Your code should now run as before, and then as you wish you can change your component classes to inherit from your application HyperComponent
base class instead of Hyperloop::Component