Skip to content

Implement Improved Query Scaffolding#365

Merged
PauloMFJ merged 9 commits into
datacommonsorg:mainfrom
madebypxlp:paulo/query-scaffold
Jun 18, 2026
Merged

Implement Improved Query Scaffolding#365
PauloMFJ merged 9 commits into
datacommonsorg:mainfrom
madebypxlp:paulo/query-scaffold

Conversation

@PauloMFJ

@PauloMFJ PauloMFJ commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Overview

This PR aims at improving interface between Atlas and queries. It should make query streaming a case of just hooking into a singular file (query_provider).

Notable changes:

  • Animated atlas when it mounts (avoid flash)
  • Implemented improved copy and paste support; now copied cards are a) placed on grid and b) reflect the original copied card while isLoading to avoid out of sync cards.
  • Improved withEditor handling for storing / handling events before tldraw is mounted; moved to promise based flow.
  • Introduced QueryProvider pattern + added improved mocked data support including connecting followUp button to query provider.
  • Implemented better card placement support.

@PauloMFJ PauloMFJ self-assigned this Jun 15, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request refactors the Atlas canvas provider and home page to support dynamic card placement, camera panning, and a dedicated query provider for streaming query results. The code reviewer provided valuable feedback on preventing memory leaks by moving side-effect cleanups from the onMount callback to a useEffect hook, avoiding compatibility issues with Promise.withResolvers, handling potential zero-width values from unmeasured canvas bounds, and guarding against empty query submissions.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread dataweaver/apps/web/src/components/scopes/atlas/atlas_provider.tsx Outdated
Comment thread dataweaver/apps/web/src/components/scopes/atlas/atlas_provider.tsx Outdated
Comment thread dataweaver/apps/web/src/components/scopes/atlas/atlas_provider.tsx Outdated
Comment thread dataweaver/apps/web/src/components/scopes/atlas/helpers.ts Outdated
Comment thread dataweaver/apps/web/src/components/scopes/page_home/page_home.tsx
@PauloMFJ PauloMFJ marked this pull request as ready for review June 15, 2026 18:55

@nick-nlb nick-nlb left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Overall looks great Paulo! Just the one comment.


// Resolves with the editor once tldraw mounts. Canvas writes chain off this,
// so `add` works whether it's called before or after mount
const [isMounted] = useState(() => {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I ran over this a couple of times because the name "isMounted" set me on the wrong track. Although the name is isMounted, this is actually storing in state a Promise to the editor itself. If we do keep this pattern, could we change the name here?

However, this might produce an issue (at least theoretically), between the lifecycle of the outer component and the editor. I don't think there's a way that this could happen with the app as it is, but if, for example, we ever had multiple swappable canvases in the future.

Because the (eventually resolved) promise is stored in state, it is permanent within the lifecycle of this outer component. If the actual canvas inside ever unmounted and another one mounted, the promise would still resolve to the first one.

Although it isn't something that would happen with the single canvas app as it is now, it does create a latent bug and makes the canvas lifecycle fragile.

I do like the previous callback-based queue with useRef, as it was very clear and easy to follow (although there might be some lifecycle fixes there). If we stick with this method, can we resolve the above issue?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good feedback! I've made a few tweaks. Still kept the promise based pattern but with improved naming across the file / use of ref. I also addressed the lack of cleanup - so unmount + remount it'll recreate the deferred promise state. Let me know if you have any further thoughts here?

@nick-nlb nick-nlb self-requested a review June 18, 2026 00:25
@PauloMFJ PauloMFJ merged commit 29982ce into datacommonsorg:main Jun 18, 2026
7 checks passed
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.

2 participants