mirror of
https://github.com/tiqi-group/pydase.git
synced 2025-04-19 16:10:01 +02:00
frontend: default export useRenderCount hook
This commit is contained in:
parent
4ed8899708
commit
c396de75fb
@ -3,7 +3,7 @@ import { runMethod } from "../socket";
|
|||||||
import { Form, Button, InputGroup, Spinner } from "react-bootstrap";
|
import { Form, Button, InputGroup, Spinner } from "react-bootstrap";
|
||||||
import { DocStringComponent } from "./DocStringComponent";
|
import { DocStringComponent } from "./DocStringComponent";
|
||||||
import { LevelName } from "./NotificationsComponent";
|
import { LevelName } from "./NotificationsComponent";
|
||||||
import { useRenderCount } from "../hooks/useRenderCount";
|
import useRenderCount from "../hooks/useRenderCount";
|
||||||
|
|
||||||
interface AsyncMethodProps {
|
interface AsyncMethodProps {
|
||||||
fullAccessPath: string;
|
fullAccessPath: string;
|
||||||
|
@ -3,7 +3,7 @@ import { ToggleButton } from "react-bootstrap";
|
|||||||
import { DocStringComponent } from "./DocStringComponent";
|
import { DocStringComponent } from "./DocStringComponent";
|
||||||
import { LevelName } from "./NotificationsComponent";
|
import { LevelName } from "./NotificationsComponent";
|
||||||
import { SerializedObject } from "../types/SerializedObject";
|
import { SerializedObject } from "../types/SerializedObject";
|
||||||
import { useRenderCount } from "../hooks/useRenderCount";
|
import useRenderCount from "../hooks/useRenderCount";
|
||||||
|
|
||||||
interface ButtonComponentProps {
|
interface ButtonComponentProps {
|
||||||
fullAccessPath: string;
|
fullAccessPath: string;
|
||||||
|
@ -3,7 +3,7 @@ import { DocStringComponent } from "./DocStringComponent";
|
|||||||
import { GenericComponent } from "./GenericComponent";
|
import { GenericComponent } from "./GenericComponent";
|
||||||
import { LevelName } from "./NotificationsComponent";
|
import { LevelName } from "./NotificationsComponent";
|
||||||
import { SerializedObject } from "../types/SerializedObject";
|
import { SerializedObject } from "../types/SerializedObject";
|
||||||
import { useRenderCount } from "../hooks/useRenderCount";
|
import useRenderCount from "../hooks/useRenderCount";
|
||||||
import useSortedEntries from "../hooks/useSortedEntries";
|
import useSortedEntries from "../hooks/useSortedEntries";
|
||||||
|
|
||||||
interface DictComponentProps {
|
interface DictComponentProps {
|
||||||
|
@ -4,7 +4,7 @@ import { DocStringComponent } from "./DocStringComponent";
|
|||||||
import { LevelName } from "./NotificationsComponent";
|
import { LevelName } from "./NotificationsComponent";
|
||||||
import { SerializedObject, SerializedEnum } from "../types/SerializedObject";
|
import { SerializedObject, SerializedEnum } from "../types/SerializedObject";
|
||||||
import { propsAreEqual } from "../utils/propsAreEqual";
|
import { propsAreEqual } from "../utils/propsAreEqual";
|
||||||
import { useRenderCount } from "../hooks/useRenderCount";
|
import useRenderCount from "../hooks/useRenderCount";
|
||||||
|
|
||||||
interface EnumComponentProps extends SerializedEnum {
|
interface EnumComponentProps extends SerializedEnum {
|
||||||
addNotification: (message: string, levelname?: LevelName) => void;
|
addNotification: (message: string, levelname?: LevelName) => void;
|
||||||
|
@ -3,7 +3,7 @@ import { Card, Collapse, Image } from "react-bootstrap";
|
|||||||
import { DocStringComponent } from "./DocStringComponent";
|
import { DocStringComponent } from "./DocStringComponent";
|
||||||
import { ChevronDown, ChevronRight } from "react-bootstrap-icons";
|
import { ChevronDown, ChevronRight } from "react-bootstrap-icons";
|
||||||
import { LevelName } from "./NotificationsComponent";
|
import { LevelName } from "./NotificationsComponent";
|
||||||
import { useRenderCount } from "../hooks/useRenderCount";
|
import useRenderCount from "../hooks/useRenderCount";
|
||||||
|
|
||||||
interface ImageComponentProps {
|
interface ImageComponentProps {
|
||||||
fullAccessPath: string;
|
fullAccessPath: string;
|
||||||
|
@ -3,7 +3,7 @@ import { DocStringComponent } from "./DocStringComponent";
|
|||||||
import { GenericComponent } from "./GenericComponent";
|
import { GenericComponent } from "./GenericComponent";
|
||||||
import { LevelName } from "./NotificationsComponent";
|
import { LevelName } from "./NotificationsComponent";
|
||||||
import { SerializedObject } from "../types/SerializedObject";
|
import { SerializedObject } from "../types/SerializedObject";
|
||||||
import { useRenderCount } from "../hooks/useRenderCount";
|
import useRenderCount from "../hooks/useRenderCount";
|
||||||
import useSortedEntries from "../hooks/useSortedEntries";
|
import useSortedEntries from "../hooks/useSortedEntries";
|
||||||
|
|
||||||
interface ListComponentProps {
|
interface ListComponentProps {
|
||||||
|
@ -3,7 +3,7 @@ import { runMethod } from "../socket";
|
|||||||
import { Button, Form } from "react-bootstrap";
|
import { Button, Form } from "react-bootstrap";
|
||||||
import { DocStringComponent } from "./DocStringComponent";
|
import { DocStringComponent } from "./DocStringComponent";
|
||||||
import { LevelName } from "./NotificationsComponent";
|
import { LevelName } from "./NotificationsComponent";
|
||||||
import { useRenderCount } from "../hooks/useRenderCount";
|
import useRenderCount from "../hooks/useRenderCount";
|
||||||
import { propsAreEqual } from "../utils/propsAreEqual";
|
import { propsAreEqual } from "../utils/propsAreEqual";
|
||||||
|
|
||||||
interface MethodProps {
|
interface MethodProps {
|
||||||
|
@ -5,7 +5,7 @@ import "../App.css";
|
|||||||
import { LevelName } from "./NotificationsComponent";
|
import { LevelName } from "./NotificationsComponent";
|
||||||
import { SerializedObject } from "../types/SerializedObject";
|
import { SerializedObject } from "../types/SerializedObject";
|
||||||
import { QuantityMap } from "../types/QuantityMap";
|
import { QuantityMap } from "../types/QuantityMap";
|
||||||
import { useRenderCount } from "../hooks/useRenderCount";
|
import useRenderCount from "../hooks/useRenderCount";
|
||||||
|
|
||||||
// TODO: add button functionality
|
// TODO: add button functionality
|
||||||
|
|
||||||
@ -176,7 +176,6 @@ export const NumberComponent = React.memo((props: NumberComponentProps) => {
|
|||||||
|
|
||||||
const handleKeyDown = (event: React.KeyboardEvent<HTMLInputElement>) => {
|
const handleKeyDown = (event: React.KeyboardEvent<HTMLInputElement>) => {
|
||||||
const { key, target } = event;
|
const { key, target } = event;
|
||||||
console.log(typeof key);
|
|
||||||
|
|
||||||
// Typecast
|
// Typecast
|
||||||
const inputTarget = target as HTMLInputElement;
|
const inputTarget = target as HTMLInputElement;
|
||||||
|
@ -7,7 +7,7 @@ import { LevelName } from "./NotificationsComponent";
|
|||||||
import { SerializedObject } from "../types/SerializedObject";
|
import { SerializedObject } from "../types/SerializedObject";
|
||||||
import { QuantityMap } from "../types/QuantityMap";
|
import { QuantityMap } from "../types/QuantityMap";
|
||||||
import { propsAreEqual } from "../utils/propsAreEqual";
|
import { propsAreEqual } from "../utils/propsAreEqual";
|
||||||
import { useRenderCount } from "../hooks/useRenderCount";
|
import useRenderCount from "../hooks/useRenderCount";
|
||||||
|
|
||||||
interface SliderComponentProps {
|
interface SliderComponentProps {
|
||||||
fullAccessPath: string;
|
fullAccessPath: string;
|
||||||
|
@ -4,7 +4,7 @@ import { DocStringComponent } from "./DocStringComponent";
|
|||||||
import "../App.css";
|
import "../App.css";
|
||||||
import { LevelName } from "./NotificationsComponent";
|
import { LevelName } from "./NotificationsComponent";
|
||||||
import { SerializedObject } from "../types/SerializedObject";
|
import { SerializedObject } from "../types/SerializedObject";
|
||||||
import { useRenderCount } from "../hooks/useRenderCount";
|
import useRenderCount from "../hooks/useRenderCount";
|
||||||
|
|
||||||
// TODO: add button functionality
|
// TODO: add button functionality
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { useRef, useEffect } from "react";
|
import { useRef, useEffect } from "react";
|
||||||
|
|
||||||
export function useRenderCount() {
|
export default function useRenderCount() {
|
||||||
const count = useRef(0);
|
const count = useRef(0);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user