Skip to content

2.0.0-rc.5 | isPending(a) != latest(isPending(a)) isPending in latest returns false instead of true #3215

Description

@mizulu

Describe the bug

after the write, calling isPending on count is true
but putting it in latest() is false

logs

[log] {pendingLatest_1: false, isPendingCount_1: false}
[log] {pendingLatest_2: false, isPendingCount_2: true}

Your Example Website or App

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

Steps to Reproduce the Bug or Issue

see reproduction

Expected behavior

it might be expected that latest will not return false for isPending
that returns true for one without latest

Screenshots or Videos

No response

Platform

.

Additional context

import { render } from '@solidjs/web';
import { createSignal, isPending, latest } from 'solid-js';






export default function App() {
  const [count, setCount] = createSignal(0);


  setTimeout(() => {

    const pendingLatest_1 = latest(() => isPending(count))
    const isPendingCount_1 = isPending(count)


    console.log({
      pendingLatest_1,
      isPendingCount_1
    })

    setCount(v => v + 1)  // start a transiton 

    const isPendingCount_2 = isPending(count) // true 
    const pendingLatest_2 = latest(() => isPending(count)) // false 

    console.log({
      pendingLatest_2,
      isPendingCount_2
    })

  })

  return (
    <div class="p-2 whitespace-pre">
      {`
      latest shadows pending state


    `}

    </div>
  );
}


if (typeof document !== 'undefined') {
  render(() => <App />, document.getElementById('root')!);
}

unlike #3104 , there is no memo in this case. just plain read, in the same scope / tick

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