Skip to content

atomWithLocation initVaule is not sync #37

@WeiShengv99

Description

@WeiShengv99

https://stackblitz.com/edit/github-3vpjew?file=src%2FApp.tsx

  • About page has url search params, and i use atomWithLocation to get it
  • Other pages dont use atomWithLocation
  • enter Home page first is required , then go to About page
    image
    baseAtom.onMount = (set) => {
    const callback = () => set(getL());
    const unsub = sub(callback);
    callback();
    return unsub;
    };
    const derivedAtom = atom(
    (get) => get(baseAtom),
    (get, set, arg: SetStateAction<T>, atomOptions: AtomOptions<T> = {}) => {
    set(baseAtom, arg);
    appL(get(baseAtom), { ...options, ...atomOptions });
    },

maybe we can return getL() when baseAtom not mount. not just get(baseAtom

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