Use cases
The use cases for dynamic configuration are endless, here are just a few ideas:- Perhaps the user who is creating the Space informs how you want that Space to look for them
- Or maybe someone’s location defines a different type of currency in your Sheet configuration
- Or say you need data from an external API in a precise moment in time to determine how you want your Workbook to look
Configuring a new Space
From the dashboard
When the “Create New Space” button is clicked on the platform, it triggers a jobevent within the space domain that
initiates a configure operation. This operation is analogous to performing
a POST request to the endpoint
/api/v1/spaces
with the parameter autoconfigure set to true.
- Filter on the
domain(space) and theoperation(configure). - Listen for a
job:readyevent. - Build your Space, at minimum including one Workbook.
- Complete the job.
- Optionally, listen for new events that are spawned from within your
space:configurejob.
Usage
In the following example, we build a Workbook and our getting started guide. You can also follow along in the flatfile-docs-kitchen-sink Github sandbox.From an embedded button
When embedding Flatfile in your application, two things can happen:- A new Space is created every time the Flatfile platform is called to open
- Or an existing Space can be passed in.
Automatically
New Spaces can be created automatically by setting up headless flows. Learn more about this use case.Updating a Space in place
As things are changing in a Space, sometimes you may want to adjust the configuration of your Space. You can do this by listening for events that take place, and performing work as a result. Continue reading for a few common examples.After an action is fired
When a button is clicked in the user interface, this creates a job. You are already listening for this job to respond and do the work of that Action; however, you may also want to adjust some of your configuration at the same time, too.Usage
In the following example, we lock down access to the original Sheet and update our getting started guide to reflect the change.After data changes
As the Sheet is being updated with data, perhaps you want to change the configuration. In the following example, we listed for a commit created to do just that.Usage
Example Project
Find the dynamic-configurations example in the Flatfile GitHub repository.typescript
Clone the dynamic-configurations example in Typescript
javascript
Clone the dynamic-configurations example in Javascript