Fix scroll restoration

This commit is contained in:
1ilit
2024-02-26 13:17:20 +02:00
parent 03cdd8eef0
commit d798a1fca9
3 changed files with 23 additions and 13 deletions

View File

@@ -571,7 +571,7 @@ export default function Editor() {
useEffect(() => {
document.title = "Editor | drawDB";
const loadLatestDiagram = () => {
const loadLatestDiagram = async () => {
db.diagrams
.orderBy("lastModified")
.last()
@@ -595,7 +595,7 @@ export default function Editor() {
});
};
const loadDiagram = (id) => {
const loadDiagram = async (id) => {
db.diagrams
.get(id)
.then((diagram) => {
@@ -625,7 +625,7 @@ export default function Editor() {
});
};
const loadTemplate = (id) => {
const loadTemplate = async (id) => {
db.templates
.get(id)
.then((diagram) => {

View File

@@ -236,6 +236,8 @@ function SurveyForm({ theme }) {
export default function Survey() {
const [theme, setTheme] = useState("");
useEffect(() => window.scroll(0, 0));
useEffect(() => {
const t = localStorage.getItem("theme");
setTheme(t);
@@ -271,7 +273,7 @@ export default function Survey() {
};
return (
<>
<div>
<div className="sm:py-3 py-5 md:px-8 px-20 flex justify-between items-center">
<div className="flex items-center justify-start">
<Link to="/">
@@ -329,6 +331,6 @@ export default function Survey() {
<div className="text-center text-sm py-3">
&copy; 2024 <strong>drawDB</strong> - All right reserved.
</div>
</>
</div>
);
}