Skip to content

Commit

Permalink
Update template to use correct immutable definitions from studio (#106)
Browse files Browse the repository at this point in the history
### Public-Facing Changes
None

### Description
Update the extension template to use the correct immutable types from
@foxglove/studio.
  • Loading branch information
foxymiles authored Jun 5, 2023
1 parent 27c7ba6 commit 0af41a5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "create-foxglove-extension",
"version": "0.8.2",
"version": "0.8.3",
"publisher": "foxglove",
"description": "Create and package Foxglove Studio extensions",
"license": "MIT",
Expand Down
10 changes: 5 additions & 5 deletions template/src/ExamplePanel.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { PanelExtensionContext, RenderState, Topic, MessageEvent } from "@foxglove/studio";
import { useLayoutEffect, useEffect, useState } from "react";
import { Immutable, MessageEvent, PanelExtensionContext, Topic } from "@foxglove/studio";
import { useEffect, useLayoutEffect, useState } from "react";
import ReactDOM from "react-dom";

function ExamplePanel({ context }: { context: PanelExtensionContext }): JSX.Element {
const [topics, setTopics] = useState<readonly Topic[] | undefined>();
const [messages, setMessages] = useState<readonly MessageEvent<unknown>[] | undefined>();
const [topics, setTopics] = useState<undefined | Immutable<Topic[]>>();
const [messages, setMessages] = useState<undefined | Immutable<MessageEvent[]>>();

const [renderDone, setRenderDone] = useState<(() => void) | undefined>();

Expand All @@ -17,7 +17,7 @@ function ExamplePanel({ context }: { context: PanelExtensionContext }): JSX.Elem
// Without a render handler your panel will never receive updates.
//
// The render handler could be invoked as often as 60hz during playback if fields are changing often.
context.onRender = (renderState: RenderState, done) => {
context.onRender = (renderState, done) => {
// render functions receive a _done_ callback. You MUST call this callback to indicate your panel has finished rendering.
// Your panel will not receive another render callback until _done_ is called from a prior render. If your panel is not done
// rendering before the next render call, studio shows a notification to the user that your panel is delayed.
Expand Down

0 comments on commit 0af41a5

Please sign in to comment.