Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@solid-primitives/context MultiProvider does not support SSR #540

Open
asaf opened this issue Nov 4, 2023 · 0 comments
Open

@solid-primitives/context MultiProvider does not support SSR #540

asaf opened this issue Nov 4, 2023 · 0 comments

Comments

@asaf
Copy link

asaf commented Nov 4, 2023

Describe the bug

Using MultiProvider with SSR causes:

Cannot read properties of undefined (reading '0')

Specifically failing on let item = values[i]; line

function MultiProvider(props) {
  const { values } = props;
  const fn = (i) => {
    let item = values[i];
    if (!item)
      return props.children;
    const ctxProps = {
      get children() {
        return fn(i + 1);
      }
    };
    if (Array.isArray(item)) {
      ctxProps.value = item[1];
      item = item[0];
      if (typeof item !== "function")
        item = item.Provider;
    }
    return createComponent(item, ctxProps);
  };
  return fn(0);
}

Minimal Reproduction Link

todo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant