SolidJSS
SolidJSโ€ข17mo agoโ€ข
9 replies
TutoDS

`createAsync` crashing my app

Hi everyone.

When I add this second createAsync my app crashes:
const contactsAndSocial = createAsync(() => getSocialNetworksAndContacts());

__vite_ssr_import_7__.getSocialNetworksAndContacts is not a function

Code:

// getSocialNetworksAndContacts
const getSocialNetworksAndContacts = cache(
  async (): Promise<SocialNetworksAndContacts> => {
    'use server';

    try {
      return client.fetch<SocialNetworksAndContacts>(getSocialNetworksAndContactsQuery);
    } catch {
      return {
        social: [],
        contacts: [],
      };
    }
  },
  'social-networks-and-contacts',
);

// getSocialNetworksAndContactsQuery
const getSocialNetworksAndContactsQuery = `
  *[_type == "settings"] [0] {
    "contacts": coalesce(contacts, []),
    "social": coalesce(social, [])
  }
`;
Was this page helpful?