Skip to content
This repository was archived by the owner on Oct 19, 2018. It is now read-only.
This repository was archived by the owner on Oct 19, 2018. It is now read-only.

uninitialized constant Hyperloop::Application #2

Open

Description

@barriehadfield

On page load after upgrading to overnight Gem 0.1.0

My store is:

class Discounter < Hyperloop::Store
   state discount: 30, scope: :class, reader: true
   state lucky_dip_taken: false, scope: :class, reader: true
  def lucky_dip!
    mutate.discount( state.discount + rand(-5..5) )
    mutate.lucky_dip_taken true
  end
end

Activity

  1. adamcreekroad commented on Feb 23, 2017

    @adamcreekroad
    Contributor

    Yeah so this is a problem I brought up to @catmando ...that class level states are initialized on the Hyperloop::Application::Boot Operation, but there's the case the you don't have HyperOperations...
    so for now you have to just mock up that code....

    class HyperOperation
      class << self
        def on_dispatch(&block)
          receivers << block
        end
    
        def receivers
          @receivers ||= []
        end
    
        def dispatch(params = {})
          receivers.each do |receiver|
            receiver.call params
          end
        end
      end
    
      def dispatch(params = {})
        self.class.receivers.each do |receiver|
          receiver.call params
        end
      end
    end
    
    module Hyperloop
      class Application
        class Boot < HyperOperation
          include React::IsomorphicHelpers
    
          before_first_mount do
            dispatch
          end
        end
      end
    end

    Just stick that somewhere like your components.rb file and you should be good to do.

  2. barriehadfield commented on Feb 23, 2017

    @barriehadfield
    MemberAuthor

    ok thanks @adamcreekroad lets leave this open until we resolve

  3. adamcreekroad commented on Feb 23, 2017

    @adamcreekroad
    Contributor

    An update: make sure it is before require_tree './components'

  4. added this to the Release 0.15 milestone on Nov 15, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions