Describe the bug
import { render } from '@solidjs/web';
import { action, createOptimistic, createSignal, flush } from "solid-js";
export default function App() {
const [signal, setSignal] = createSignal(0);
const [optimisticValue, setOptimisticValue] = createOptimistic(signal);
/**
* Click "Run once"
actual:
logs:
0 0
0 0
expected:
logs:
0 0
0 1
signal used in an optimistic signal source, prevents flushing of the signal
in an "action"
*/
const run = action(function* () {
console.log(optimisticValue(), signal())
setSignal(1);
flush()
console.log(optimisticValue(), signal())
});
return (
<main>
<button onClick={run}>Run once</button>
<p>Value: {optimisticValue()}</p>
</main>
);
}
if (typeof document !== 'undefined') {
render(() => <App />, document.getElementById('root')!);
}
Your Example Website or App
https://s.olid.uk/id/ILIMhE-cRXeISRjlRaxXwQ
Steps to Reproduce the Bug or Issue
see playground
Expected behavior
probably not what we are getting.
Screenshots or Videos
No response
Platform
.
Additional context
issue might share common root cause with #3330
or not.
https://s.olid.uk/id/RmxCWTx3RXmTFMsAb5b58g
edit: verdict is that the bug is allowing flush in action, and it is expected that no flush should be allowed in an action.
as shown in the followup comment below
Describe the bug
Your Example Website or App
https://s.olid.uk/id/ILIMhE-cRXeISRjlRaxXwQ
Steps to Reproduce the Bug or Issue
see playground
Expected behavior
probably not what we are getting.
Screenshots or Videos
No response
Platform
.
Additional context
issue might share common root cause with #3330
or not.
https://s.olid.uk/id/RmxCWTx3RXmTFMsAb5b58g
edit: verdict is that the bug is allowing flush in
action, and it is expected that no flush should be allowed in an action.as shown in the followup comment below