@zenflux/react-commander 0.0.8 → 0.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "$schema": "https://raw.githubusercontent.com/SchemaStore/schemastore/master/src/schemas/json/package.json",
3
3
  "name": "@zenflux/react-commander",
4
4
  "author": "Leonid Vinikov <leonidvinikov@gmail.com> (https://github.com/iNewLegend)",
5
- "version": "0.0.8",
5
+ "version": "0.0.10",
6
6
  "type": "module",
7
7
  "sideEffects": false,
8
8
  "types": "src/index.ts",
@@ -180,8 +180,8 @@ class CommandsManager {
180
180
  throw new Error( `Component '${ componentName }' not registered` );
181
181
  }
182
182
 
183
- // @ts-ignore - If it hot reloads then skip the error
184
- const shouldSilentError = !! typeof import.meta.hot?.hmrClient.pruneMap.size;
183
+ // If HMR is active, suppress errors for missing contexts during hot reload
184
+ const shouldSilentError = !! import.meta.hot;
185
185
 
186
186
  const singleComponentContext = core[ GET_INTERNAL_SYMBOL ]( componentNameUnique, shouldSilentError ) as DCommandSingleComponentContext;
187
187
 
@@ -22,9 +22,12 @@ import type { CommandBase } from "@zenflux/react-commander/command-base";
22
22
  *
23
23
  * Sugar, e.g `ComponentType.getName` not `ComponentInstance`
24
24
  **/
25
- export interface DCommandFunctionComponent<TProps = any, TState = undefined> extends React.FC<TProps> {
25
+ export interface DCommandFunctionComponent<TProps = object, TState = undefined> {
26
26
  ( props: TProps, state?: TState ): React.ReactNode;
27
27
 
28
+ displayName?: string;
29
+ defaultProps?: Partial<TProps>;
30
+
28
31
  // Those methods always implemented "under the hood"
29
32
  getName?(): string;
30
33
  }
@@ -47,7 +47,7 @@ export function useCommand( commandName: string, ref?: React.RefObject<any> ) {
47
47
  const debug = ( ..._args: Array<unknown> ) => {
48
48
  try {
49
49
  // TODO: Enable when needed
50
- console.debug( "[react-commander/useCommand]", ..._args );
50
+ // console.debug( "[react-commander/useCommand]", ..._args );
51
51
  } catch {}
52
52
  };
53
53