You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
client scope optimization doesn't work if all scope is dummy or unknown #78
Load the all scope, notice that the active todo count sticks at one,
then when we look at the active scope, it only contains one (wrong usually) item.
Problem is occuring because on the footer we do a count of the active scope. Presumably this causes the completed client side scoping rule to be run, but on the dummy 'all' scope.
# hyper-model/spec/batch4/scope_spec.rb:315it'the client filter will not be applied to unloaded scope'doisomorphicdoTestModel.class_evaldoscope:quicker,->{where(completed: true)},client: ->{completed}endendFactoryBot.create(:test_model,test_attribute: 'model-1',completed: false)FactoryBot.create(:test_model,test_attribute: 'model-2',completed: true)FactoryBot.create(:test_model,test_attribute: 'model-3',completed: false)FactoryBot.create(:test_model,test_attribute: 'model-4',completed: true)mount'TestComponent2'doclassTestComponent2 < HyperComponentclass << selfstate_accessor:scopeendbefore_mountdo@render_count=1endbefore_updatedo@render_count=@render_count + 1endrender(DIV)do# render the all scope first, which will create a unloaded/dummy collection for allUL{TestModel.send(TestComponent2.scope || :all).each{ |test_model| LI{test_model.test_attribute}}}# now get the count of the quicker (client side) scope, which must NOT use the dummy all collection as a baseDIV{"quicker.count = #{TestModel.quicker.count}"}endendendpage.shouldhave_content('.count = 2')evaluate_rubydoTestComponent2.scope=:allendpage.shouldhave_content('model-2')page.shouldhave_content('model-4')page.should_nothave_content('model-1',wait: 0)page.should_nothave_content('model-3',wait: 0)end
Activity
catmando commentedon Dec 7, 2018
here is a failing test spec
catmando commentedon Dec 7, 2018
note order is important if you move
DIV { "quicker.count ... }first it works.catmando commentedon Dec 7, 2018
it appears that adding the following guard to the beginning of
sync_collection_with_parentdoes the trick:return if @parent.dummy_collectioncatmando commentedon Jan 15, 2019
closed. for example see batch4/scope_spec.rb
it 'the client filter will not be applied to unloaded scope but will be applied once the scope is loaded'gemspecs: a blank version selector must mean unset (hyperstack-org#78)
Merge branch 'fix/issue-78-version-selector' into 'edge'