kibana
kibana copied to clipboard
Update XState (main)
This PR contains the following updates:
Package | Change | Age | Adoption | Passing | Confidence |
---|---|---|---|---|---|
@xstate/react (source) | ^3.2.2 -> ^4.1.1 |
||||
xstate (source) | ^4.38.2 -> ^5.14.0 |
Release Notes
statelyai/xstate (@xstate/react)
v4.1.1
Patch Changes
-
#4844
5aa6eb05c
Thanks @davidkpiano! - TheuseSelector(…)
hook from@xstate/react
is now compatible with stores from@xstate/store
.import { createStore } from '@​xstate/store'; import { useSelector } from '@​xstate/react'; const store = createStore( { count: 0 }, { inc: { count: (context) => context.count + 1 } } ); function Counter() { // Note that this `useSelector` is from `@xstate/react`, // not `@xstate/store/react` const count = useSelector(store, (state) => state.context.count); return ( <div> <button onClick={() => store.send({ type: 'inc' })}>{count}</button> </div> ); }
v4.1.0
Minor Changes
-
#4231
c2402e7bc
Thanks @davidkpiano! - Theactor
passed touseSelector(actor, selector)
is now allowed to beundefined
for an actor that may not exist yet. For actors that may beundefined
, thesnapshot
provided to theselector
function can also beundefined
:const count = useSelector(maybeActor, (snapshot) => { // `snapshot` may be undefined return snapshot?.context.count; }); count; // number | undefined
v4.0.3
Patch Changes
-
#4695
52900a084
Thanks @davidkpiano! - Options increateActorContext
are now properly merged with provider options. Previously, provider options replaced the actor options.const { inspect } = createBrowserInspector(); const SomeContext = createActorContext(someMachine, { inspect }); // ... // Options are now merged: // { inspect: inspect, input: 10 } <SomeContext.Provider options={{ input: 10 }}> {/* ... */} </SomeContext.Provider>;
v4.0.2
Patch Changes
-
#4600
1f2ccb97c
Thanks @davidkpiano! - Typegen-based types for detecting missing implementations have been removed internally.
v4.0.1
Patch Changes
-
#4497
d7f220225
Thanks @davidkpiano! - Fix an issue whereafter
transitions do not work in React strict mode. Delayed events (including fromafter
transitions) should now work as expected in all React modes.
v4.0.0
Major Changes
-
#3947
5fa3a0c74
Thanks @davidkpiano! - Removed the ability to pass a factory function as argument touseMachine
. -
#4006
42df9a536
Thanks @davidkpiano! -useActorRef
is introduced, which returns anActorRef
from actor logic:const actorRef = useActorRef(machine, { ... }); const anotherActorRef = useActorRef(fromPromise(...));
~~
useMachine
~~ is deprecated in favor ofuseActor
, which works with machines and any other kind of logic-const [state, send] = useMachine(machine); +const [state, send] = useActor(machine); const [state, send] = useActor(fromTransition(...));
~~
useSpawn
~~ is removed in favor ofuseActorRef
-const actorRef = useSpawn(machine); +const actorRef = useActorRef(machine); The previous use of `useActor(actorRef)` is now replaced with just using the `actorRef` directly, and with `useSelector`: ```diff -const [state, send] = useActor(actorRef); +const state = useSelector(actorRef, s => s); // actorRef.send(...)
-
#4050
fc88dc8e6
Thanks @davidkpiano! - Theoptions
prop has been added (back) to theContext.Provider
component returned fromcreateActorContext
:const SomeContext = createActorContext(someMachine); // ... <SomeContext.Provider options={{ input: 42 }}> {/* ... */} </SomeContext.Provider>;
-
#4006
42df9a536
Thanks @davidkpiano! -useActor
has been removed from the created actor context, you should be able to replace its usage withMyCtx.useSelector
andMyCtx.useActorRef
. -
#4265
1153b3f9a
Thanks @davidkpiano! - FSM-related functions have been removed. -
#3947
5fa3a0c74
Thanks @davidkpiano! - Implementations for machines onuseMachine
hooks should go directly on the machine viamachine.provide(...)
, and are no longer allowed to be passed in as options.-const [state, send] = useMachine(machine, { - actions: { - // ... - } -}); +const [state, send] = useMachine(machine.provide({ + actions: { + // ... + } +}));
-
#3148
7a68cbb61
Thanks @davidkpiano! - RemovedgetSnapshot
parameter from hooks. It is expected that the receivedactorRef
has to have agetSnapshot
method on it that can be used internally.
Minor Changes
-
#3727
5fb3c683d
Thanks @Andarist! -exports
field has been added to thepackage.json
manifest. It limits what files can be imported from a package - it's no longer possible to import from files that are not considered to be a part of the public API. -
#4240
409552cf8
Thanks @davidkpiano! - TheuseMachine
function is an alias ofuseActor
. -
#4436
340aee643
Thanks @Andarist! - Fast refresh now works as expected for most use-cases. -
#4050
fc88dc8e6
Thanks @davidkpiano! - TheobserverOrListener
argument has been removed from the 3rd argument ofcreateActorContext(logic, options)
.
Configuration
📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
👻 Immortal: This PR will be recreated if closed unmerged. Get config help if that's undesired.
- [ ] If you want to rebase/retry this PR, check this box
This PR has been generated by Mend Renovate. View repository job log here.
Pinging @elastic/infra-monitoring-ui (Team:Infra Monitoring UI)
For this upgrade to a major version, the official Xstate docs states:
XState v5 and its related libraries are written in TypeScript, and utilize complex types to provide the best type safety and inference possible for you. XState v5 requires TypeScript version 5.0 or greater. For best results, use the latest TypeScript version.
We are currently on v4.x.x of typescript, which constrains us on this upgrade. It also comes with breaking changes that required to update the current implementations depending on this library.
Pinging @elastic/obs-ux-logs-team (Team:obs-ux-logs)
/ci
:broken_heart: Build Failed
- Buildkite Build
- Commit: cf03e30d828690596a8caf097fcdd7e1eee584c0
- Interpreting CI Failures
Failed CI Steps
History
- :broken_heart: Build #184651 failed 5dc6b9d5afaadb739d80b7f42fe5d5d2173b8dfe
- :broken_heart: Build #183797 failed 4ea2002cd723862610ce84125b144d9ba9fb8b75
- :broken_heart: Build #183707 failed 7722356d3d7a5c5fc21d521e0fa6e426e708fcb1
- :broken_heart: Build #183439 failed 005bda47e104a3e17b38b804fcfc272b12afe26d
- :broken_heart: Build #183053 failed 3f3e4c6a95d905682e414e5cd7cdee38f546bb16
To update your PR or re-run it, just comment with:
@elasticmachine merge upstream
I'm withdrawing my approval, since I reviewed this when it was just a minor version upgrade. It feels dangerous for the renovate bot to replace the PR content with a major version upgrade after approval.
Created an issue to track the major upgrade work
Edited/Blocked Notification
Renovate will not automatically rebase this PR, because it does not recognize the last commit author and assumes somebody else may have edited the PR.
You can manually request rebase by checking the rebase/retry box above.
⚠️ Warning: custom changes will be lost.
Closing in favour of PRs to be opened by Self-Hosted Renovate.