mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
In an effort to remove the workpad renaming lag in https://github.com/elastic/kibana/issues/25070, I started hunting down and fixing re-renders that happened with the name change. I was hoping this PR would fix the lag, but I've shifted to some other performance issues that have a much larger impact, so this is just a bunch of re-rendering fixes, which come with some performance gains. Here's the breakdown: - `Workpad`, `WorkpadHeader`, and `FullscreenControl` would always re-render because the hotkey handler function was always re-created - `Workpad` would re-render when the workpad's name changed - We were passing the whole workpad object into the component, so it re-rendered on all sorts of changes - Page title updating moved to middleware so the component doesn't need that value - `AssetManager` would always re-render if the parent re-rendered because it always created a new state value in `mapStateToProps` - make `Workpad` and `Toolbar` pure, they take no props and this helps stop some re-rendering
23 lines
1.2 KiB
JavaScript
23 lines
1.2 KiB
JavaScript
/*
|
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
* or more contributor license agreements. Licensed under the Elastic License;
|
|
* you may not use this file except in compliance with the Elastic License.
|
|
*/
|
|
|
|
export const CANVAS_TYPE = 'canvas-workpad';
|
|
export const CANVAS_APP = 'canvas';
|
|
export const APP_ROUTE = '/app/canvas';
|
|
export const APP_ROUTE_WORKPAD = `${APP_ROUTE}#/workpad`;
|
|
export const API_ROUTE = '/api/canvas';
|
|
export const API_ROUTE_WORKPAD = `${API_ROUTE}/workpad`;
|
|
export const API_ROUTE_WORKPAD_ASSETS = `${API_ROUTE}/workpad-assets`;
|
|
export const API_ROUTE_WORKPAD_STRUCTURES = `${API_ROUTE}/workpad-structures`;
|
|
export const LOCALSTORAGE_PREFIX = `kibana.canvas`;
|
|
export const LOCALSTORAGE_CLIPBOARD = `${LOCALSTORAGE_PREFIX}.clipboard`;
|
|
export const LOCALSTORAGE_AUTOCOMPLETE_ENABLED = `${LOCALSTORAGE_PREFIX}.isAutocompleteEnabled`;
|
|
export const LOCALSTORAGE_LASTPAGE = 'canvas:lastpage';
|
|
export const FETCH_TIMEOUT = 30000; // 30 seconds
|
|
export const CANVAS_USAGE_TYPE = 'canvas';
|
|
export const DEFAULT_WORKPAD_CSS = '.canvasPage {\n\n}';
|
|
export const VALID_IMAGE_TYPES = ['gif', 'jpeg', 'png', 'svg+xml'];
|
|
export const ASSET_MAX_SIZE = 25000;
|