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

development build: solidjs reactivity is broken #8

Closed
milahu opened this issue Dec 23, 2022 · 1 comment
Closed

development build: solidjs reactivity is broken #8

milahu opened this issue Dec 23, 2022 · 1 comment

Comments

@milahu
Copy link

milahu commented Dec 23, 2022

i have this simple src/pages/options/Options.tsx

setResults has no effect in development build, but it works in production build

probably same issue as #7

import logo from "@assets/img/logo.svg";
import "@src/styles/index.css";
import styles from "./Options.module.css";
import {createSignal} from "solid-js"
import {For} from "solid-js"

const Options = () => {
  let searchButton;
  const [getResults, setResults] = createSignal([
    "result0",
    "result0",
  ])
  setTimeout(() => {
    // update results
    console.log("update")
    setResults((old) => old.concat(["result3"]))
    setResults((old) => old.concat(["result4"]))
  }, 1000)
  function startSearch(event) {
    event.preventDefault()
    console.log("submit")
    searchButton.innerHTML = "Searching...";
    searchButton.disabled = true;
    // clear results
    console.log("clear")
    setResults([
      "result1",
      "result2",
    ])
    // update results
    console.log("update")
    setResults((old) => old.concat(["result3"]))
    setResults((old) => old.concat(["result4"]))
  }
  return (
    <div class={styles.App}>
      <form class={styles.form} onSubmit={startSearch}>
        <input/>
        <button ref={searchButton}>Search</button>
      </form>
      <ol class={styles.results}>
        <For each={getResults()}>
          {result => (
            <li>result: {JSON.stringify(result, null, 2)}</li>
          )}
        </For>
      </ol>
      <pre>{JSON.stringify(getResults(), null, 2)}</pre>
    </div>
  );
};

export default Options;
@milahu
Copy link
Author

milahu commented Dec 23, 2022

probably same issue as #7

yes

@milahu milahu closed this as completed Dec 23, 2022
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