Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Ref is not available on page reload without a setTimeout workaround #12

Open
hugomcm opened this issue Jan 14, 2025 · 1 comment
Open

Comments

@hugomcm
Copy link

hugomcm commented Jan 14, 2025

This situation only happens on page reload, but not on navigation.
Wasn't it supposed to be at least available inside onMount?

export function MyGrid() {
  let gridRef
  console.log('gridRefA:', gridRef)
  onMount(() => console.log('gridRefB:', gridRef))
  setTimeout(() => console.log('gridRefC:', gridRef), 100)

  return <AgGridSolid ref={gridRef} />
}

// outputs
gridRefA: undefined
gridRefB: undefined
gridRefC: Object { api, .... }

@thedanchez
Copy link
Contributor

@hugomcm yeah, this seems like a bug to me based on your description. When the view is mounted I would expect the ref to be assigned for sure.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants