From af87149bf779e8a354f65ff8ca36d9e6033454be Mon Sep 17 00:00:00 2001 From: Michael Lustig Date: Mon, 8 Apr 2024 16:09:33 -0400 Subject: [PATCH] Update meta docs for v5 and provide a little more description --- docs/finite-states.mdx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/finite-states.mdx b/docs/finite-states.mdx index ef7c671f..8ed27e71 100644 --- a/docs/finite-states.mdx +++ b/docs/finite-states.mdx @@ -164,7 +164,7 @@ Read more about [tags](tags.mdx). ## Meta -Meta data is static data that describes relevant properties of a state node. You can specify meta data on the `.meta` property of any state node. This can be useful for displaying information about a state node in a UI, or for generating documentation. +Meta data is static data that describes relevant properties of a state node. You can specify meta data on the `.meta` property of any state node. This can be useful for displaying information about a state node in a UI, or for generating documentation. You may access the state node's `meta` properties at runtime with the following: `yourActor.getSnapshot().getMeta()`. Note only "top level" `meta` and the current state's `meta` fields will be returned in `getMeta()`. The `state.meta` property collects the `.meta` data from all active state nodes and places them in an object with the state node’s ID as the key and the `.meta` data as the value: @@ -197,7 +197,7 @@ const feedbackMachine = createMachine({ const feedbackActor = createActor(feedbackMachine).start(); -console.log(feedbackActor.getSnapshot().meta); +console.log(feedbackActor.getSnapshot().getMeta()); // logs the object: // { // feedback: {