-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Edit after events #4521
Edit after events #4521
Conversation
🦋 Changeset detectedLatest commit: 1c48110 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 1c48110:
|
packages/core/src/eventUtils.ts
Outdated
export function createAfterEvent(delayRef: number | string, id?: string) { | ||
const idSuffix = id ? `#${id}` : ''; | ||
return { type: `xstate.after(${delayRef})${idSuffix}` } as const; | ||
return { type: `xstate.after.${delayRef}.${idSuffix}` } as const; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
id
is always provided from what I can see, let's make that argument required and drop this conditional expression (just inline the id
directly in the type
)
Co-authored-by: Mateusz Burzyński <mateuszburzynski@gmail.com>
packages/core/src/eventUtils.ts
Outdated
const idSuffix = id ? `#${id}` : ''; | ||
return { type: `xstate.after(${delayRef})${idSuffix}` } as const; | ||
export function createAfterEvent(delayRef: number | string, id: string) { | ||
return { type: `xstate.after.${delayRef}.#${id}` } as const; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed the #
from the auto-generated invokeId
. Should we do the same here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure; also in general, we just have to make sure that any .
in places like delayRef
are escaped and account for those; that's an edge-case though.
# Conflicts: # packages/core/src/stateUtils.ts
94916b1
to
c82d3b6
Compare
The event type of internal
after
events changed fromxstate.after(1000)#some.state.id
toxstate.after.1000.#some.state.id
for consistency.