Skip to content

Commit

Permalink
⚡️ Improve performance of debugNode in release
Browse files Browse the repository at this point in the history
  • Loading branch information
Khaoz-Topsy committed Jun 19, 2024
1 parent 47b6055 commit dc50128
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 12 deletions.
15 changes: 8 additions & 7 deletions .github/workflows/github-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ run-name: GithubPages

on:
push:
branches: ['main']
branches: ['main', 'develop']

concurrency:
group: 'githubpages'
Expand All @@ -29,12 +29,13 @@ jobs:
- name: Setup variables
run: |
touch .env
echo "${{ secrets.VITE_NMSUD_FORM_WEB_URL }}" >> .env
echo "${{ secrets.VITE_NMSUD_API_URL }}" >> .env
echo "${{ secrets.VITE_NMSUD_FORM_DATA_URL }}" >> .env
echo "${{ secrets.VITE_NMSUD_FORM_DOCS_URL }}" >> .env
echo "${{ secrets.VITE_ENABLE_CAPTCHA }}" >> .env
echo "${{ secrets.VITE_HCAPTCHA_SITE_KEY }}" >> .env
echo VITE_NMSUD_FORM_WEB_URL="${{ secrets.VITE_NMSUD_FORM_WEB_URL }}" >> .env
echo VITE_NMSUD_FORM_WEB_URL="${{ secrets.VITE_NMSUD_FORM_WEB_URL }}" >> .env
echo VITE_NMSUD_API_URL="${{ secrets.VITE_NMSUD_API_URL }}" >> .env
echo VITE_NMSUD_FORM_DATA_URL="${{ secrets.VITE_NMSUD_FORM_DATA_URL }}" >> .env
echo VITE_NMSUD_FORM_DOCS_URL="${{ secrets.VITE_NMSUD_FORM_DOCS_URL }}" >> .env
echo VITE_ENABLE_CAPTCHA="${{ secrets.VITE_ENABLE_CAPTCHA }}" >> .env
echo VITE_HCAPTCHA_SITE_KEY="${{ secrets.VITE_HCAPTCHA_SITE_KEY }}" >> .env
- name: Build web UI
run: |
Expand Down
7 changes: 6 additions & 1 deletion src/services/internal/documentService.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { Container, Service, Token } from 'typedi';
import { Container, Service } from 'typedi';

import { AppImage } from '@constants/image';
import { site } from '@constants/site';
import { getLog } from '@services/internal/logService';
import { getConfig } from './configService';

interface IAddScriptToHead {
id: string;
Expand All @@ -14,6 +15,10 @@ interface IAddScriptToHead {

@Service()
export class DocumentService {
initDebug = () => {
(window as unknown as { debug: boolean }).debug = !getConfig().isProd();
};

setDocumentTitle = (pageTitle: string) => {
document.title = `${site.title} - ${pageTitle}`;
};
Expand Down
1 change: 1 addition & 0 deletions src/web/components/appShell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ const lazyVerify = lazy(() => import('@web/pages/verify'));

export const AppShell: Component = () => {
Container.set(APP_TYPE, AppType.UI);
getDocumentServ().initDebug();
getDocumentServ().addVideoBackground();

const Routes = useRoutes([
Expand Down
5 changes: 1 addition & 4 deletions src/web/components/core/debugNode.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
import { Component } from 'solid-js';

import { getConfig } from '@services/internal/configService';

interface IProps {
name: string;
}

export const DebugNode: Component<IProps> = (props: IProps) => {
const renderDebug =
getConfig().isProd() != true || (window as unknown as { debug: boolean }).debug == true;
const renderDebug = (window as unknown as { debug: boolean })?.debug === true;
if (!renderDebug) {
return;
}
Expand Down

0 comments on commit dc50128

Please sign in to comment.