Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Assistants settings] Update reported data backend #871

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

mishig25
Copy link
Collaborator

@mishig25 mishig25 commented Feb 22, 2024

Only check if current assistant that is being viewed was reported.

Previously, we were checking reported status on all the assistants of a user. However, this reported status is only useful for the assistant that is currently being viewed

@mishig25 mishig25 marked this pull request as ready for review February 23, 2024 00:02
@mishig25 mishig25 changed the title [Assistants settings] Update data backend [Assistants settings] Update reported data backend Feb 23, 2024
@@ -21,6 +22,30 @@ async function assistantOnlyIfAuthor(locals: App.Locals, assistantId?: string) {
return assistant;
}

export async function load({ parent, params, locals }) {
const data = await parent();
Copy link
Member

@coyotte508 coyotte508 Feb 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that this triggers the root's +layout.server.ts's load.

So each time we switch assistant, this will trigger a load of all assistants

IMO we can keep the redirect in page.ts - that way the load isn't triggered - since the frontend will be able to execute it.


TLDR:

  • Keep page.ts as is
  • remove the redirect / parent() call here
  • The rest of the PR is great!

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

handled in 1d5994f

@nsarrazin
Copy link
Collaborator

How does it work when you have both a server load function and a universal load function for the same +page.svelte ? Seems like the type checker is not super happy about it haha but couldn't find more info about it

@mishig25 mishig25 marked this pull request as draft February 23, 2024 13:43
@coyotte508
Copy link
Member

coyotte508 commented Feb 23, 2024

How does it work when you have both a server load function and a universal load function for the same +page.svelte ? Seems like the type checker is not super happy about it haha but couldn't find more info about it

// `data` comes from the server load function
export async function load({ parent, data }) {
	const res = await parent();

	// checks
	...

	return data;
}

Something like that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants