-
Notifications
You must be signed in to change notification settings - Fork 12
while_loading doesn't work with external Hyperloop::Component #102
Comments
class LoadingComponent < Hyperloop::Component
render do
SPAN { 'loading...' }
end
end
class MainComponent < Hyperloop::Component
state last_name: nil
before_mount do
mutate.last_name User.find(1).last_name
end
render do
DIV do
state.last_name
end
.while_loading do
LoadingComponent {}
end
end
end |
@aberios okay the first case will be closed shortly, but the second case is may be more difficult, as it will require changing the semantics of Meanwhile if you needed to do the second case it could be rewritten like this: class LoadingComponent < Hyperloop::Component
render do
SPAN { 'loading...' }
end
end
class MainComponent < Hyperloop::Component
before_mount do
ReactiveRecord.load do
User.find(1).last_name
end.then do |last_name|
mutate.last_name last_name
end
end
render do
if state.last_name
DIV { state.last_name }
else
LoadingComponent {}
end
end
end The thing is this second case is really not needed, as your active record model data is already using reactive states, so having the "state.last_name" is just a redundant copy of It could be the case that you want to have a state like |
The following doesn't appear to work.
Appears to have something to do with an
INPUT
'sdefaultValue
.The text was updated successfully, but these errors were encountered: