The Custom Blocks contest deadline is approaching! Do you have questions about releasing or debugging your block? We’re hosting our third live Ask Me Anything (AMA) session in this thread on Wednesday (6/24) at 11am PT.
Billy Littlefield and Tim Deng from our platform engineering team will be ready to answer any development questions you have.
We’ll be picking 3 questions at random to win a $40 Amazon gift card. Any solutions offered by the community will be included in the draw as well. You can even start posting your questions now, and we’ll be answering questions live from 11am - 11:30am PT on Wednesday. See you there!
The block I’m building will require an external library’s CSS to be imported/loaded. My original plan was to install Webpack to do this, but there weren’t any Blocks examples that use it. To your knowledge, would I be able to install webpack as I would with any other React app, or would the Custom Blocks setup require a different approach? Does the way Blocks are transpiled interfere with Webpack?
There was some discussion about writing tests for custom blocks a while ago. I’m still finding the most success with the “test mode” that I had suggested to the original poster, but I’m curious if you could expand on Kasra’s second idea:
If I have a
layout function that makes calls to Custom Block APIs, wouldn’t I still need access to those functions outside of the Airtable environment to perform a unit test? Or was Kasra’s suggestion more along the lines of a
layout function would be called before passing to an Airtable API and the unit test could be used as a way to ensure valid information is being passed in?
Do you have any advice or guidelines on how to present errors to users? I know some of the examples include permissions and other checks before performing operations for Airtable-specific API calls. More generally though, can you share best practices, UI-wise, on how to present users with error information?
Some ideas I can think of are:
Obviously, some/all/none of these might work for different use cases. I’m trying to see if there’s any built-in UI components (I don’t think so?) or best ways to incorporate custom components (like
I’ve just finished a very first version of Image Annotation block. Here is a demo: https://www.youtube.com/watch?v=1O6hSDny2TA. Could you give me some feedback on what to improve before releasing it?
And some more quesitons:
I have a button that creates a new record using
createRecordAsync() when clicked. I would like to open the newly created record once this is done using
createRecordAsync() only provides the record ID and not the record object. Loading the new record using
useRecordById() seems to break hook rules; this is all in an async function. Any advice?
I think you’ll need to do those as separate actions. So create the record and close out that
async action. You have your recordID, so in a new action use that record to expand it. Trying to access a newly created record within the same
async block that it is being created generally isn’t going to work because you aren’t guaranteed to have the record available yet. But once you’ve
awaited the return of the
async function, you can be guaranteed to have that recordID to work with.
It’s also just generally good practice to segment out actions like this. It’s the universal temptation for developers to get as much done in a single go or block of code as possible. It feels more efficient, and it feels quicker, like you can get more done with fewer lines of code. That’s probably true; but in the long run, using more lines of code, and more tedious-feeling cycles of “doing an action --> saving the result --> doing some new action on that result” will result in generally more resilient and easier to understand/modify/expand code.
Is there a way for a block to put up an alert outside the context of the block itself?
For example, if a block is monitoring a table and notices an error condition, is there some way for the block to notify the user, even if the user does not look at the block? Modal dialog boxes seem to work only in the context of the block, and
alert is very ugly and probably best for debugging purposes.
It appears that in order to have a remote release of a block, the block author needs to be a collaborator with creator permissions in the target base. Can you confirm this?
Is there a way to install a custom block without the developer being a creator?
Does the block remain after the developer/creator is no longer a collaborator?
There was a little discussion about external CSS files and Webpack in this topic thread and the answer seems to be: not currently possible. It seems like external CSS can only be loaded using
I’m curious to hear from the Airtable folks how block transpiling interacts with Webpack and/or other command-line tools.
I noticed that when I click the “Custom” button next to the name of a custom block, it shows
Is all of this information set automatically? Can we change it to display a different name or email address?
I noticed that there is a version number in
block.json. Is this version number displayed to the block user anywhere?
Are there guidelines for where to display version information to the user?
Could it be included along with the contact info for the block developer when the “Custom” button is clicked?
It looks like the
.block folder lists remotes, including base app ids. I’d rather not include my app ids in a public git repository.
However, this folder is not included in the .gitignore file by default.
What are the implications of adding this folder to the .gitignore file?
How hard will it be for someone to re-create my custom block if I add this folder to .gitignore?
Several times when I try to create a new block from the command line, I get
npm enoent errors, and can’t create the new block. I can’t tell any difference between when it works and when it doesn’t. Sometimes I have to come back hours later and try again.
Some good guidelines to follow:
We have a number of UI components that can help with some of these interactions this built into the SDK:
iconprop which can help illustrate intent, and
You’re also welcome to use third-party libraries as you would in other apps (e.g.
npm install cool-ui-library ). If you have any feedback about the UI components that do exist in the SDK (see the docs site for a full list) we’d love to hear it!