Skip to content

Scope layer default styles to project - #495

Open
annehaley wants to merge 7 commits into
masterfrom
proj-scope-default-style
Open

annehaley wants to merge 7 commits into
masterfrom
proj-scope-default-style

Conversation

@annehaley

@annehaley annehaley commented Sep 15, 2026

Copy link
Copy Markdown
Collaborator

Resolves #491. With these changes, you can now have the same dataset added to two different projects, and the styles created for that dataset's layers in one project will not affect the other project.

This PR removes the default_style field from the Layer object. That field was mixing the Layer scope (dataset-based) with the LayerStyle scope (project-based). Instead, this PR adds back the is_default boolean field on the LayerStyle. A Layer can have more than one LayerStyle where is_default is True, but only one per project.

When the client fetches the available layers for a dataset, it now sends the project ID as a query parameter. The LayerSerializer will include the default style for that project. If a project ID is not provided in the query parameters, then the default style will be None.

This PR also adds a test for the various behaviors relating to the scope of a default style. The test checks the following behaviors:

  1. Default style will be None if no project ID provided or if no styles with is_default=True exist for the layer in the provided project.
  2. If a layer has a default style A in a project, then a new style B with is_default=True is created in that project for that layer, then style B will be the new default style for that layer in that project, and style A will have its is_default value set to False.
  3. If style A is modified and sets is_default back to True, then style A will be the default again and style B will have its is_default value set to False.
  4. If style A is then deleted, style B will have its is_default value set back to True again.

@annehaley
annehaley force-pushed the proj-scope-default-style branch from 7682bb3 to 4e12413 Compare September 18, 2026 19:20
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Sep 18, 2026

Copy link
Copy Markdown

Deploying geodatalytics with  Cloudflare Pages  Cloudflare Pages

Latest commit: 4e12413
Status: ✅  Deploy successful!
Preview URL: https://bfe17178.geodatalytics.pages.dev
Branch Preview URL: https://proj-scope-default-style.geodatalytics.pages.dev

View logs

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.

Scope layer default styles to projects

1 participant