Skip to content

client scope optimization doesn't work if all scope is dummy or unknown #78

Closed
@catmando

Description

@catmando

try the todo example, with prerendering off and then in Todo model:

class Todo < ApplicationRecord
  scope :completed, -> () { where(completed: true)  }, client: -> { completed }
  scope :active,    -> () { where(completed: false) }, client: -> { !completed }
end

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.

If you remove the footer the problem goes away.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingready-to-releaseInternal Use Only: Has been fixed, specs passing and pushed to edge branch

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions