-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: Fix fast refresh invalidations (#1150)
Fixes #727 as best we can w/o requiring major changes. HMR works best w/ functional components and that's too big of a change to switch everything to functional components just for HMR. Added an eslint rule which will warn about things that will almost certainly invalidate HMR. Fixed the warnings it emitted. Tested locally by changing some displayed text values in some panels and seeing if the page triggered a full reload. I didn't have any specific files/cases that triggered full reloads previously and it seems Vite 4 has made it better on its own. If we start running into cases. Saving `GridRenderer` doesn't trigger a full page reload (didn't before either), but massively slows the page (also had this behavior prior to this change). The change eventually propagates and refreshes We should keep an eye on vitejs/vite#12062 which will likely also fix the slow HMR issues on some components. There seems to be duplication of modules in the update list and it can explode at times (like GridRenderer triggers 14 unique modules, but 20k updates consisting of just those 14) BREAKING CHANGE: Renamed `renderFileListItem` to `FileListItem`. Renamed `RenderFileListItemProps` to `FileListItemProps`. Removed exports for `ConsolePlugin.assertIsConsolePluginProps`, `GridPlugin.SUPPORTED_TYPES`, `FileList.getPathFromItem`, `FileList.DRAG_HOVER_TIMEOUT`, `FileList.getItemIcon`, `Grid.directionForKey`, `GotoRow.isIrisGridProxyModel`, and `Aggregations.SELECTABLE_OPTIONS`. These were all only being consumed within their own file and are not consumed in enterprise
- Loading branch information
1 parent
362928f
commit 2606826
Showing
53 changed files
with
392 additions
and
304 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/* eslint-disable import/prefer-default-export */ | ||
export function addSeparators(value: string): string { | ||
const dateTimeMillis = value.substring(0, 23); | ||
const micros = value.substring(23, 26); | ||
const nanos = value.substring(26); | ||
return [dateTimeMillis, micros, nanos].filter(v => v !== '').join('\u200B'); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* eslint-disable import/prefer-default-export */ | ||
export function DEFAULT_GET_PREFERRED_REPLACEMENT_STRING( | ||
value: string, | ||
replaceIndex: number, | ||
newChar: string | ||
): string { | ||
return ( | ||
value.substring(0, replaceIndex) + | ||
newChar + | ||
value.substring(replaceIndex + 1) | ||
); | ||
} | ||
|
||
/** | ||
* Fill the string on the right side with the example value to the given length | ||
* @param checkValue Initial string to pad | ||
* @param exampleValue Example value | ||
* @param length Target length | ||
* @returns String padded with the given example value | ||
*/ | ||
export function fillToLength( | ||
checkValue: string, | ||
exampleValue: string, | ||
length: number | ||
): string { | ||
return checkValue.length < length | ||
? `${checkValue}${exampleValue.substring(checkValue.length, length)}` | ||
: checkValue; | ||
} | ||
|
||
/** | ||
* Trim all characters matching the empty mask on the right side of the given value | ||
* @param value String to trim | ||
* @param emptyMask Empty mask | ||
* @returns Trimmed string | ||
*/ | ||
export function trimTrailingMask(value: string, emptyMask: string): string { | ||
let { length } = value; | ||
for (let i = value.length - 1; i >= 0; i -= 1) { | ||
if (emptyMask[i] === value[i]) { | ||
length = i; | ||
} else { | ||
break; | ||
} | ||
} | ||
return value.substring(0, length); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
packages/dashboard-core-plugins/src/panels/ChartPanelUtils.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import type { ChartPanelMetadata, ChartPanelTableMetadata } from './ChartPanel'; | ||
|
||
// eslint-disable-next-line import/prefer-default-export | ||
export function isChartPanelTableMetadata( | ||
metadata: ChartPanelMetadata | ||
): metadata is ChartPanelTableMetadata { | ||
return (metadata as ChartPanelTableMetadata).settings !== undefined; | ||
} |
Oops, something went wrong.