update
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import React, { useState, useEffect, useMemo, useRef, useLayoutEffect } from "react";
|
||||
import React, { useState, useEffect } from "react";
|
||||
import { useStore } from "./store.js";
|
||||
import { resourcesInstance, apiInstance } from "./api.js";
|
||||
|
||||
@@ -29,7 +29,7 @@ function SelectResource({ onChange }) {
|
||||
|
||||
const subject = subjects[newSubject];
|
||||
const topic = subject.topics[newTopic];
|
||||
const resource = topic.resources.at(-1);
|
||||
const resource = topic.resources.at(-1) ?? { id: "/", filename: "/", version: 0 };
|
||||
|
||||
onChange({
|
||||
subjectName: subject.name,
|
||||
@@ -95,9 +95,7 @@ function SelectResource({ onChange }) {
|
||||
}
|
||||
|
||||
function ResourcePage() {
|
||||
return (
|
||||
<Content token="aaaaaa" initialContent="# hola" subjectName="asdasd" topicTitle="tiilte" />
|
||||
);
|
||||
return <Content />;
|
||||
}
|
||||
|
||||
function useFileContent(file) {
|
||||
@@ -108,6 +106,11 @@ function useFileContent(file) {
|
||||
if (!file) {
|
||||
return;
|
||||
}
|
||||
if (file.version === 0) {
|
||||
setIsLoading(false);
|
||||
setContent("");
|
||||
return;
|
||||
}
|
||||
let ignore = false;
|
||||
setIsLoading(true);
|
||||
setContent(null);
|
||||
|
||||
Reference in New Issue
Block a user