Skip to content

Non reactive update #15

@az-001-zkdm

Description

@az-001-zkdm
import { useEffect } from react
import { observer, $ } from 'teamplay'

const UserProfile = observer(({ userId }) => {
  const $initialized = $.session.tables.userExample.initialized
  const initialized = $initialized.get()
  const $table = $.session.tables.userExample

  // if (!$table.get()) $table.set({})                         // line 1

  useEffect(() => {
      $table.schema.set([])                                    // line 2
      setTimeout(() => {
        $initialized.set(true)
      }, 100)
  }, [])

  console.log('res:', initialized)

  return <div>hello</div>>
})

Never show res:true in the console. but you can fix it either by commenting line2 or uncommenting line 1

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