Skip to content

2.0.0-beta.19 | createOptimisticStore a derived optimistic store in another optimistic store does not "inherit" the pending when using affects() #2904

Description

@mizulu

Describe the bug

s2.a does not show isPending even though it is derived from s.a which is pending by an explicit call to affects(s,'a')

  let [s,ss] = createOptimisticStore(()=>{
    return {a:1}
  }, {a:0})

  let [s2,ss2] = createOptimisticStore(()=>{
    return s 
  }, {a:0} as unknown as any)


  console.log('s.a',isPending(()=>s.a))
  console.log('s2.a', isPending(()=>s2.a))
  affects(s,'a')
  console.log('affects (s,"a")')
  console.log('s.a',isPending(()=>s.a))  // s.a is pending due to an explict affect 
  console.log('s2.a', isPending(()=>s2.a)) // s2.a is derived from s.a but is not pending 

Your Example Website or App

https://s.olid.uk/id/rp_IuUpuTqO9bYy85uoFGA

Steps to Reproduce the Bug or Issue

run code.

Expected behavior

derived key in an optimistic store, from another optimistic store, should also derive the explicit pending set by the affects() call on the store key.

Screenshots or Videos

Image

Platform

.

Additional context

source for llm

Activity

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

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions