Skip to content

Commit 8b22e7d

Browse files
committed
Merge branch 'develop' of github.com:devtron-labs/devtron-fe-common-lib into fix/approval-policy
2 parents 1bf3a88 + 810c37c commit 8b22e7d

File tree

8 files changed

+35
-17
lines changed

8 files changed

+35
-17
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,3 +105,4 @@ typings/
105105

106106
.DS_Store
107107
.npmrc
108+
.build-cache

package-lock.json

Lines changed: 7 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@devtron-labs/devtron-fe-common-lib",
3-
"version": "1.2.5-beta-8",
3+
"version": "1.2.6-beta-1",
44
"description": "Supporting common component library",
55
"type": "module",
66
"main": "dist/index.js",
@@ -48,7 +48,7 @@
4848
"@typescript-eslint/eslint-plugin": "8.3.0",
4949
"@typescript-eslint/parser": "8.3.0",
5050
"@vitejs/plugin-react": "4.3.1",
51-
"eslint": "^8.56.0",
51+
"eslint": "^8.57.1",
5252
"eslint-config-airbnb": "^19.0.4",
5353
"eslint-config-prettier": "^9.1.0",
5454
"eslint-import-resolver-typescript": "^3.6.1",
@@ -107,6 +107,7 @@
107107
"tslib": "2.7.0"
108108
},
109109
"overrides": {
110+
"cross-spawn": "^7.0.5",
110111
"react-dates": {
111112
"react": "^17.0.2",
112113
"react-dom": "^17.0.2"

src/Common/Api.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,14 @@ async function fetchAPI<K = object>(
150150
})
151151
} else {
152152
handleLogout()
153-
return { code: 401, status: 'Unauthorized', result: [] }
153+
// Using this way to ensure that the user is redirected to the login page
154+
// and the component has enough time to get unmounted otherwise the component re-renders
155+
// and try to access some property of a variable and log exception to sentry
156+
return await new Promise((resolve) => {
157+
setTimeout(() => {
158+
resolve({ code: 401, status: 'Unauthorized', result: [] })
159+
}, 1000)
160+
})
154161
}
155162
} else if (response.status >= 300 && response.status <= 599) {
156163
return await handleServerError(contentType, response)

src/Common/Helper.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,7 @@ export const getUrlWithSearchParams = <T extends string | number = string | numb
512512
/**
513513
* Custom exception logger function for logging errors to sentry
514514
*/
515-
export const logExceptionToSentry = Sentry.captureException.bind(window)
515+
export const logExceptionToSentry: typeof Sentry.captureException = Sentry.captureException.bind(window)
516516

517517
export const customStyles = {
518518
control: (base, state) => ({

src/Common/Markdown/MarkDown.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,10 @@ const MarkDown = ({ setExpandableIcon, markdown, className, breaks, disableEscap
4747
if (task) {
4848
return `<li style="list-style: none">
4949
<input disabled type="checkbox" ${checked ? 'checked' : ''} class="dc__vertical-align-middle" style="margin: 0 0.2em 0.25em -1.4em">
50-
${text}
50+
${marked(text)}
5151
</li>`
5252
}
53-
return `<li>${text}</li>`
53+
return `<li>${marked(text)}</li>`
5454
}
5555

5656
renderer.image = ({ href, title, text }: Tokens.Image) =>
@@ -60,7 +60,7 @@ const MarkDown = ({ setExpandableIcon, markdown, className, breaks, disableEscap
6060
<div class="table-container">
6161
<table>
6262
<thead>
63-
<tr>${header.map((headerCell) => `<th align="${headerCell.align}">${headerCell.text}</th>`).join('')}</tr>
63+
<tr>${header.map((headerCell) => `<th align="${headerCell.align}">${marked(headerCell.text)}</th>`).join('')}</tr>
6464
</thead>
6565
<tbody>
6666
${rows.map((row) => renderTableRow(row)).join('')}

src/Shared/Store/IndexStore.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,10 @@ export const IndexStore = {
257257
_nodesFilteredSubject.next([..._nodes])
258258
},
259259

260+
clearAppDetails() {
261+
this.publishAppDetails({}, null)
262+
},
263+
260264
getAppDetails: (): AppDetails => _appDetailsSubject.getValue(),
261265

262266
getAppDetailsObservable: () => _appDetailsSubject.asObservable(),

vite.config.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import libAssetsPlugin from '@laynezh/vite-plugin-lib-assets'
2323
import svgr from 'vite-plugin-svgr'
2424
import { NodeGlobalsPolyfillPlugin } from '@esbuild-plugins/node-globals-polyfill'
2525
import tsconfigPaths from 'vite-tsconfig-paths'
26-
import { ViteImageOptimizer } from 'vite-plugin-image-optimizer'
26+
// import { ViteImageOptimizer } from 'vite-plugin-image-optimizer'
2727
import * as packageJson from './package.json'
2828

2929
// https://vitejs.dev/config/
@@ -42,9 +42,13 @@ export default defineConfig({
4242
NodeGlobalsPolyfillPlugin({
4343
process: true,
4444
}),
45-
ViteImageOptimizer({
46-
logStats: false,
47-
}),
45+
// Commented since it merges the attributes of svg there by messing up with
46+
// the styles
47+
// ViteImageOptimizer({
48+
// logStats: false,
49+
// cache: true,
50+
// cacheLocation: '.build-cache/vite-image-optimizer',
51+
// }),
4852
],
4953
build: {
5054
target: 'ES2021',

0 commit comments

Comments
 (0)