+
Skip to content

Bug: clientFetcher crashes when accessing params from third argument + refetch returns stale data #117

@AshrefRaj

Description

@AshrefRaj

Description:
We're encountering two issues with the Catalyst's clientFetcher:


1. Crash when accessing params from third argument

NotificationsPage.clientFetcher = (_, { store }, { params }) => {
  return makeApiCall("/app-api/v1/app/notifications", {
    dispatch: store.dispatch,
    params
  })
}

When trying to access params from the third argument in clientFetcher, it throws the following error:

TypeError: Cannot destructure undefined
    at _objectDestructuringEmpty (http://localhost:3006/app.bundle.js:5619:56)
    at push.5722.Home.clientFetcher (http://localhost:3006/app.bundle.js:5619:5066)
    at http://localhost:3006/npm.router.dist.index.js..bundle.js:11:22045
    at p (http://localhost:3006/npm.router.dist.index.js..bundle.js:11:14304)
    at Generator.<anonymous> (http://localhost:3006/npm.router.dist.index.js..bundle.js:11:15650)
    at Generator.next (http://localhost:3006/npm.router.dist.index.js..bundle.js:11:14733)
    at g (http://localhost:3006/npm.router.dist.index.js..bundle.js:11:20219)
    at s (http://localhost:3006/npm.router.dist.index.js..bundle.js:11:20422)
    at http://localhost:3006/npm.router.dist.index.js..bundle.js:11:20481
    at new Promise (<anonymous>)

2. refetch returns stale data

The refetch function behavior is inconsistent:

  • Calling refetch() without params returns the initial page-load API data instead of returning fresh data.
  • Passing new params to refetch(params) causes the function to break, likely due to the above destructuring issue.

Expected:

  • refetch should always trigger a fresh API call and return the latest data.
  • refetch with new params should properly update the fetch without breaking.

Steps to Reproduce:

  1. Access params from the third argument in clientFetcher.
  2. Call refetch() without or with params after initial page load.
  3. Observe error and stale data being returned.

  • Catalyst client version: 0.0.3-canary.11

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

      点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载