Skip to content

[Bug]: lynx.__globalProps.queryItems is empty #62

Description

@Nyx2022

Preflight checklist

  • I searched existing issues to avoid duplicates.
  • I can reproduce this issue on the latest main (or have provided the exact version/commit below).

Component

packages/sparkling-sdk

What happened?

i pass some params to another page in android environment,but the new page can not get the params values by lynx.__globalProps.queryItems

Steps to reproduce

page A's codes:

navigate({
                  path: 'detail.lynx.bundle',
                  options: {
                    params: {
                      title:"caslkj",
                      isDarkMode1: true,
                      itemId1: "1223223",
                      hide_nav_bar: 1,
                    },
                    animated: true,

                  },

                },
                  (res) => {
                    if (res.code !== 0) {
                      console.error('error:', res.msg);
                    }
                  });

detail's codes:

export function App(props: { onMounted?: () => void }) {
  let [isDarkMode, setIsDarkMode] = useState(false)

  let [itemId, setItemId] = useState("abc")

  useEffect(() => {
    console.info('Hello, Sparkling second page')
    console.info('lynx.__globalProps', lynx.__globalProps)

  
    if (lynx.__globalProps && lynx.__globalProps.queryItems) {
      let { itemId1, isDarkMode1 } = lynx.__globalProps.queryItems;
      console.info('gotten :', { itemId1, isDarkMode1 });
      setIsDarkMode(isDarkMode1)
      setItemId(itemId1)
    }

    props.onMounted?.()
  }, [props])

}

even the ide has the error

Image

Expected behavior

set the itemId1 to 1223223 that passed from page a

Actual behavior

itemId1 is null or ""

Logs / screenshots

Environment

  • Host OS: windows 11
  • Target platform (Android/iOS): android
  • Node.js version: 25
Image

Contribution

  • I’m willing to submit a PR to fix this.

Activity

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

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions