Skip to content

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

@hugomcm

Description

@hugomcm

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, .... }

Activity

thedanchez

thedanchez commented on Feb 3, 2025

@thedanchez
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.

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

        Participants

        @hugomcm@thedanchez

        Issue actions

          Ref is not available on page reload without a setTimeout workaround · Issue #12 · solidjs-community/solid-ag-grid