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

Feature Request: Support for deep Structured Keys #149

Open
unnoq opened this issue Dec 31, 2024 · 3 comments
Open

Feature Request: Support for deep Structured Keys #149

unnoq opened this issue Dec 31, 2024 · 3 comments
Labels
✨ feature request a new feature request

Comments

@unnoq
Copy link

unnoq commented Dec 31, 2024

Hi, I'm the author of oRPC, a library for typesafe API. I'm exploring the possibility of integrating oRPC with pinia-colada. However, I've encountered a limitation with the way pinia-colada handles the key part of its functionality.

Context

oRPC requires the key to support structured formats like the following:

['__ORPC__', ['planet', 'list', 'infinite'], { type: 'query', input: { keyword: 'abc', limit: 9 } }]

Additionally, a query with the key above needs to be revalidated with these related keys:

  • ['__ORPC__', ['planet'], {}]
  • ['__ORPC__', ['planet'], { type: 'query' }]
  • ['__ORPC__', ['planet', 'list'], {}]
  • ['__ORPC__', ['planet', 'list'], { input: { keyword: 'abc' } }]

The type: 'query' part can be ignored if there are no plans to support infinite queries, but the flexibility to handle structured keys is essential for oRPC's functionality.

Request

Would it be possible to enhance pinia-colada to support structured keys as described? This would enable seamless integration with oRPC and potentially other libraries that rely on complex key structures.

Thank you for considering this request! Let me know if further details or clarification are needed.

@github-project-automation github-project-automation bot moved this to 🆕 Triaging in Pinia Colada Roadmap Dec 31, 2024
@posva posva changed the title Feature Request: Support for Complex Structured Keys Feature Request: Support for deep Structured Keys Jan 1, 2025
@posva
Copy link
Owner

posva commented Jan 1, 2025

Currently only structured keys are supported but this should be doable. I think it could even be implemented with a pinia colada plugin that intercepts invalidateEntry actions and applies custom invalidation

@posva posva added the ✨ feature request a new feature request label Jan 1, 2025
@unnoq
Copy link
Author

unnoq commented Jan 1, 2025

Currently only structured keys are supported but this should be doable. I think it could even be implemented with a pinia colada plugin that intercepts invalidateEntry actions and applies custom invalidation

I think it's should built-in, if we want exact match you already has exact: true option for that like the way tanstack query does

@posva
Copy link
Owner

posva commented Jan 1, 2025

It seems like a very niche case for generated keys, so a plugin is probably a better fit not to impact size but who knows. Note that the plugin can also be implemented directly on your library so you don’t have to wait

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨ feature request a new feature request
Projects
Status: 🆕 Triaging
Development

No branches or pull requests

2 participants