fix(client): add safety check on path.id split
This commit is contained in:
parent
ecab1e0bfa
commit
ee328186c8
|
@ -5,3 +5,6 @@
|
|||
|
||||
# Project Dependencies
|
||||
node_modules
|
||||
|
||||
# macOS
|
||||
.DS_Store
|
|
@ -1 +1,2 @@
|
|||
/build
|
||||
/release
|
|
@ -30,6 +30,8 @@ class MainActivity : AppCompatActivity() {
|
|||
webView.settings.javaScriptEnabled = true
|
||||
webView.settings.userAgentString = "Mozilla/5.0 (Linux; Android 8.0; Pixel 2 Build/OPD3.170816.012) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.82 Mobile Safari/537.36"
|
||||
|
||||
WebView.setWebContentsDebuggingEnabled(true)
|
||||
|
||||
swipeLayout.setOnRefreshListener {
|
||||
webView.reload()
|
||||
|
||||
|
|
|
@ -41,14 +41,14 @@ const Section: React.FC<Props> = ({
|
|||
const visibility = useAppSelector<boolean>((state) => get(state.resume, `${path}.visible`, true));
|
||||
|
||||
const handleAdd = () => {
|
||||
const id = path.split('.').at(-1) as string;
|
||||
const id = path ? (path.split('.').at(-1) as string) : '';
|
||||
const modal: ModalName = validate(id) ? 'builder.sections.custom' : `builder.${path}`;
|
||||
|
||||
dispatch(setModalState({ modal, state: { open: true, payload: { path } } }));
|
||||
};
|
||||
|
||||
const handleEdit = (item: ListItem) => {
|
||||
const id = path.split('.').at(-1) as string;
|
||||
const id = path ? (path.split('.').at(-1) as string) : '';
|
||||
const modal: ModalName = validate(id) ? 'builder.sections.custom' : `builder.${path}`;
|
||||
const payload = validate(id) ? { path, item } : { item };
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ const Heading: React.FC<Props> = ({
|
|||
|
||||
const [editMode, setEditMode] = useState(false);
|
||||
|
||||
const id = useMemo(() => path && path.split('.').at(-1), [path]);
|
||||
const id = useMemo(() => (path ? path.split('.').at(-1) : ''), [path]);
|
||||
|
||||
const icon = sections.find((x) => x.id === id)?.icon || <Grade />;
|
||||
|
||||
|
|
|
@ -82,7 +82,7 @@ export const resumeSlice = createSlice({
|
|||
},
|
||||
deleteSection: (state: Resume, action: PayloadAction<DeleteSectionPayload>) => {
|
||||
const { path } = action.payload;
|
||||
const id = path && path.split('.').at(-1);
|
||||
const id = path ? path.split('.').at(-1) : '';
|
||||
|
||||
const sections = Object.keys(state.sections).filter((x) => x !== id);
|
||||
const layout = state.metadata.layout.map((pages) => pages.map((list) => list.filter((x) => x !== id)));
|
||||
|
|
Loading…
Reference in New Issue