back to stable (pre bad test)
This commit is contained in:
+2
-10
@@ -115,16 +115,8 @@ const App: Component = () => {
|
|||||||
<Show when={getEmbedView() === 'embed_notes'}>
|
<Show when={getEmbedView() === 'embed_notes'}>
|
||||||
{(() => {
|
{(() => {
|
||||||
const noteIdFromUrl = createMemo(() => {
|
const noteIdFromUrl = createMemo(() => {
|
||||||
const loc = location();
|
const params = new URLSearchParams(new URL(location()).search);
|
||||||
const url = new URL(loc);
|
return params.get('noteId');
|
||||||
// Try standard search params
|
|
||||||
let id = url.searchParams.get('noteId');
|
|
||||||
if (!id && url.hash.includes('?')) {
|
|
||||||
// Try parsing from hash (for hash-based routing)
|
|
||||||
const hashSearch = url.hash.split('?')[1];
|
|
||||||
id = new URLSearchParams(hashSearch).get('noteId');
|
|
||||||
}
|
|
||||||
return id;
|
|
||||||
});
|
});
|
||||||
console.log('[DEBUG App] Rendering embed/notes context. noteId trace:', noteIdFromUrl());
|
console.log('[DEBUG App] Rendering embed/notes context. noteId trace:', noteIdFromUrl());
|
||||||
return <NotepadView selectedNoteId={noteIdFromUrl()} setSelectedNoteId={() => { }} hideNavigation={!!noteIdFromUrl()} />;
|
return <NotepadView selectedNoteId={noteIdFromUrl()} setSelectedNoteId={() => { }} hideNavigation={!!noteIdFromUrl()} />;
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import PocketBase from 'pocketbase';
|
import PocketBase from 'pocketbase';
|
||||||
|
|
||||||
export const pb = new PocketBase('https://pocketbase.ccllc.pro');
|
export const pb = new PocketBase('https://pocketbase.ccllc.pro');
|
||||||
pb.autoCancellation(false);
|
|
||||||
|
|
||||||
export const TASGRID_COLLECTION = 'TasGrid';
|
export const TASGRID_COLLECTION = 'TasGrid';
|
||||||
export const TAGS_COLLECTION = 'TasGrid_Tags';
|
export const TAGS_COLLECTION = 'TasGrid_Tags';
|
||||||
|
|||||||
@@ -756,13 +756,9 @@ export const subscribeToRealtime = async () => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
let isInitializing = false;
|
|
||||||
export const initStore = async () => {
|
export const initStore = async () => {
|
||||||
if (isInitializing) return;
|
|
||||||
if (!pb.authStore.isValid) return;
|
if (!pb.authStore.isValid) return;
|
||||||
|
|
||||||
isInitializing = true;
|
|
||||||
try {
|
|
||||||
// 0. Synchronous hydration from localStorage for "instant" first paint
|
// 0. Synchronous hydration from localStorage for "instant" first paint
|
||||||
const key = getStorageKey();
|
const key = getStorageKey();
|
||||||
if (key) {
|
if (key) {
|
||||||
@@ -1095,9 +1091,6 @@ export const initStore = async () => {
|
|||||||
toast.error("Failed to sync with server.");
|
toast.error("Failed to sync with server.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} finally {
|
|
||||||
isInitializing = false;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// -- Actions --
|
// -- Actions --
|
||||||
|
|||||||
+6
-12
@@ -232,8 +232,7 @@ function syncAuth(iframe) {
|
|||||||
<span>Notes Embed</span>
|
<span>Notes Embed</span>
|
||||||
<code style="font-size: 10px;">/embed/notes</code>
|
<code style="font-size: 10px;">/embed/notes</code>
|
||||||
</div>
|
</div>
|
||||||
<iframe id="notes-iframe" src="https://tasgrid.ccllc.pro/embed/notes"
|
<iframe id="notes-iframe" src="http://localhost:4000/embed/notes" onload="syncAuthOnLoad(this)"></iframe>
|
||||||
onload="syncAuthOnLoad(this)"></iframe>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="iframe-container">
|
<div class="iframe-container">
|
||||||
@@ -242,7 +241,7 @@ function syncAuth(iframe) {
|
|||||||
<span>Quick Add Embed</span>
|
<span>Quick Add Embed</span>
|
||||||
<code style="font-size: 10px;">/embed/quick-add</code>
|
<code style="font-size: 10px;">/embed/quick-add</code>
|
||||||
</div>
|
</div>
|
||||||
<iframe id="quick-add-iframe" src="https://tasgrid.ccllc.pro/embed/quick-add"
|
<iframe id="quick-add-iframe" src="http://localhost:4000/embed/quick-add"
|
||||||
onload="syncAuthOnLoad(this)"></iframe>
|
onload="syncAuthOnLoad(this)"></iframe>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -254,13 +253,8 @@ function syncAuth(iframe) {
|
|||||||
function syncAuthOnLoad(iframe) {
|
function syncAuthOnLoad(iframe) {
|
||||||
console.log(`Iframe ${iframe.id} loaded, checking auth sync...`);
|
console.log(`Iframe ${iframe.id} loaded, checking auth sync...`);
|
||||||
if (pb.authStore.isValid) {
|
if (pb.authStore.isValid) {
|
||||||
console.log(`Syncing existing auth to ${iframe.id} ONLY`);
|
console.log(`Syncing existing auth to ${iframe.id}`);
|
||||||
const payload = {
|
sendAuthToIframes();
|
||||||
type: "TASGRID_AUTH",
|
|
||||||
token: pb.authStore.token,
|
|
||||||
user: pb.authStore.model
|
|
||||||
};
|
|
||||||
iframe.contentWindow.postMessage(payload, "*");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -268,9 +262,9 @@ function syncAuth(iframe) {
|
|||||||
const id = document.getElementById('note-id-input').value.trim();
|
const id = document.getElementById('note-id-input').value.trim();
|
||||||
const iframe = document.getElementById('notes-iframe');
|
const iframe = document.getElementById('notes-iframe');
|
||||||
if (id) {
|
if (id) {
|
||||||
iframe.src = `https://tasgrid.ccllc.pro/embed/notes?noteId=${id}`;
|
iframe.src = `http://localhost:4000/embed/notes?noteId=${id}`;
|
||||||
} else {
|
} else {
|
||||||
iframe.src = `https://tasgrid.ccllc.pro/embed/notes`;
|
iframe.src = `http://localhost:4000/embed/notes`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user