-
Notifications
You must be signed in to change notification settings - Fork 410
Escape special characters in Monaco tokens and fix black screen in application #5085
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -3,6 +3,9 @@ import { curryRight } from 'lodash' | |||||||||
| import { Maybe } from 'uiSrc/utils' | ||||||||||
| import { IRedisCommand } from 'uiSrc/constants' | ||||||||||
|
|
||||||||||
| // Escape special regex characters in tokens | ||||||||||
| const escapeRegex = (str: string) => str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&') | ||||||||||
|
|
||||||||||
|
Comment on lines
5
to
+8
|
||||||||||
| // Escape special regex characters in tokens | |
| const escapeRegex = (str: string) => str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&') | |
| import { escapeRegex } from 'uiSrc/utils/regex' |
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -5,6 +5,8 @@ import { generateQuery } from 'uiSrc/utils/monaco/monarchTokens/redisearchTokens | |||||||
| import { ICommandTokenType, IRedisCommand } from 'uiSrc/constants' | ||||||||
| import { DefinedArgumentName } from 'uiSrc/pages/workbench/constants' | ||||||||
|
|
||||||||
| const escapeRegex = (str: string) => str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&') | ||||||||
|
|
||||||||
|
Comment on lines
7
to
+9
|
||||||||
| const escapeRegex = (str: string) => str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&') | |
| import { escapeRegex } from 'uiSrc/utils/regex' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
escapeRegexutility function is duplicated across three different files. Consider extracting it to a shared utility module (e.g.,utils/regex.ts) and importing it to maintain DRY principles and ensure consistency.