Giter Club home page Giter Club logo

nimpl-getters's People

Contributors

vordgi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

nimpl-getters's Issues

Fix test workflows

next.js for some reason does not build the application in github workflow. Just after running the build command, next finish it immediately. Need to understand why.

Locally (Windows) all tests work correctly

Why `AsyncLocalStorage` instead of `cache`

Hey there @vordgi thanks for some great contributions :)

I'm just trying to learn more about these things and am aware of ye olde createServerContext function from canary and how it was discontinued. I am also aware that many library authors that needed a server context to avoid prop drilling or pass state to faraway components (for example next-intl) used react's cache function to get a shared store.

They'd have us hydrate it with information within every layout and every page, since these may be rendered separately and at different times and can't share state - but the component tree inside them would have a shared state thanks to cache. There are many blogposts on the topic created since, explaining how to make getter/setter patterns with it.

Your approach was the first time I've seen AsyncLocalStorage used ever, and the first time I've seen it used to replace cache. Can you please, pretty please, tell me more about the two. Why did you go with AsyncLocalStorage over cache, is it something that the Next.JS team is also doing, does it in any way help solve the layout/page issue etc.

thank you <3

Update readme

Add info about examples and tests to readme
Update old sections

Doesn't provide base url ?

I tried each of the methods and none of them returns the base url (ex: localhost:3000)
Is there any way to currently do this ?

Rename to @nimpl/getters

I decided to collect all existing and planned next.js implementations solutions in one place.

I hope this helps improve the community and opportunities for growth.

Release v1.0.0

Now the code is covered with tests that run automatically for canary next.js version, the main functionality has been added and tested. I think the package is ready for v1.0.0

Use getSearchParams() without force-dynamic for draft mode requests ?

Hi there,

I'm not using export const dynamic = 'force-dynamic' as I'm trying to use static rendering where possible, I understand though that unlike getPathname(), getSearchParams() requires dynamic rendering as the search params can only be known at request time, not build time.

However I wondered if it's still possible to use it in draft mode, which is rendered at request time, eg.

import { getSearchParams } from 'next-impl-getters/get-search-params';
import { draftMode } from 'next/headers';

const { isEnabled } = draftMode();

if (isEnabled) {
  // Page is being dynamically rendered
  const token = getSearchParams({ ignoreDynamicOptionErrors: true }).get('token');
} else {
  // Page is being statically rendered

}

This does work locally, but not on a preview deployment on Vercel.

Is this possible? Or am I missing something

Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.