Coder Social home page Coder Social logo

Comments (5)

Marlon-Buckley avatar Marlon-Buckley commented on July 28, 2024 1

Following up on this, I discovered that If I have another flag inside useFlags(), and if that flag is always enabled in the Flagsmith console, the isLoading property behaves as I'd expect.

export default function Home() {
	const flagsmith = useFlagsmith();
	const flags = useFlags(['first_feature', 'foo']);

	useEffect(() => {
		document.title = 'Home';
	}, []);

	if (!flagsmith.isLoading) {
		return (
			<>
				{flags.first_feature.enabled && (
					<p>{flagsmith.identity} has first_feature flag enabled🎉</p>
				)}
				<h1>home page</h1>
			</>
		);
	}
}

So in this version, the first_feature flag is disabled on the Flagsmith console and the foo flag is enabled. flagsmith.isLoading starts out as false, then changes to true and finally ends up false as I'd expect.

from flagsmith-js-client.

kyle-ssg avatar kyle-ssg commented on July 28, 2024 1

Apologies for the silence on this @Marlon-Buckley @vik-buchinski, I've tested internally and am happy with the current PR. I'll be getting this reviewed by our team, in the meantime there is a beta version on npm - 3.18.5-beta7

from flagsmith-js-client.

kyle-ssg avatar kyle-ssg commented on July 28, 2024

Hey @Marlon-Buckley, isLoading was actually intended just for internal use at this time, hence why it wasn't referenced in our docs. We do have plans for adding a strategy for loading state as it's a bit more complex than just isLoading when you consider cache and default flags.

Please refer to #169, if it interests you I could publish a beta for this to see if it fits your usecase?

from flagsmith-js-client.

Marlon-Buckley avatar Marlon-Buckley commented on July 28, 2024

Hi @kyle-ssg thanks for explaining, that makes sense. I'd be happy to test out the changes in #169, if that's not too much trouble!

from flagsmith-js-client.

vik-buchinski avatar vik-buchinski commented on July 28, 2024

@kyle-ssg Hello!
Any progress or deadline for releasing #169 ?

Thanks in advance!

from flagsmith-js-client.

Related Issues (20)

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.