Help

Re: AMA Custom Blocks Contest Edition #3 - Releasing your block

2998 0
cancel
Showing results for 
Search instead for 
Did you mean: 
Michelle_Valent
7 - App Architect
7 - App Architect

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!

35 Replies 35

Adding your .block folder to your git ignore will prevent it from syncing to your git remote, but it’ll still be on your local computer. If you’re the only one working on the custom block and you only use one computer, this isn’t an issue (otherwise, everyone else collaborating on your block will need the same app and base IDs). If you’re concerned about other users, ignoring your .block folder should be fine! They can choose “Remix from GitHub” when creating a custom block, and it will automatically create a .block folder for them.

Ah, interesting use case. With the useRecordActionData hook, the data always will be the latest press, so you wouldn’t register a separate click. I think you can register a callback directly, though, using registerRecordActionDataCallback which should execute the registered callback on every push (even if its the same button).

I wonder if there’s value in providing a timestamp or ID in the action payload to distinguish between these clicks using the hook.

EDIT: Another solution here would be to use a usePrevious hook, e.g.

function usePrevious(value) {
	const ref = React.useRef();
	React.useEffect(() => {
		ref.current = value;
	});
	return ref.current;
}

This way, you can compare the value returned by useRecordActionData() for subsequent presses. Even if the same record is clicked, the object returned by useRecordActionData on a subsequent button press will be a new object compared to the value cached by usePrevious.

function MyComponent() {
    const buttonData = useRecordActionData();
    const lastButtonData = usePrevious(buttonData);
    useEffect(() => {
        if (buttonData !== lastButtonData && buttonData) {
            // perform logic for button press
        }
    }, [buttonData, lastButtonData])
    
   // ... rest of component ...
}

I think that’s the most logical way – barebones example:

function MyComponent() {
    const [isLoading, setIsLoading] = useState(false);
    
    function fetchTheThing() {
        setIsLoading(true);
        
        fetch('example.com').then(response => {
            // do stuff with response
            setIsLoading(false);
        })
    }

    return (
        <Box>
            {isLoading ? (
                <Loader />
            ) : (
                <RestOfApp />
            )}
        </Box>
    )
}

Correct, currently only creators can create, release, and install blocks in a given base. It’s not currently possible to install a custom block without creator permissions. If the developer/creator is removed from the base, the block will remain. Releasing, publishing, and sharing blocks is something we’re thinking about for the future in order to reduce friction for both the developer and consumers.

Tim_Deng
Airtable Employee
Airtable Employee

And that’s a wrap! If you have any further questions, you can always find us in the custom blocks beta forum. The winners for this week are @Yuriy_Klyuch, @kuovonne, and @Kirill_Madorin!

With the contest deadline fast approaching (July 6th), we’ll be hosting our last AMA in the custom blocks contest series next week with a twist! Instead of AMA, we’ve got a fun “AYA” format planned. The post will be up EoD Friday and will be open until 6pm PT on Thursday, July 1. We’ll be giving out Amazon gift cards to three of the most insightful posts. Stay tuned!

Exciting to see your block in action! I’ll have to refrain from providing feedback now, assuming this is an entrant in the current blocks contest. Happy to answer your questions, though!

  1. It’s not currently possible to specify field values using RecordQueryResultOpts, but if you create a view in the main product that performs this filtering, you can select records from just that view.
  2. Unfortunately, linked record fields are not included in the current scope of metadata writes (along with formulaic fields) - some work still needs to be done on what that API looks like.
  3. You can’t currently configure the build, but CSS can be loaded using loadCSSFromString or loadCSSFromURLAsync.
  4. We don’t currently provide any built-in tooling for error logging. In theory, you could log errors to an “Errors” table in the base, but that may not be the best approach depending on your use-case.