diff --git a/Cargo.lock b/Cargo.lock index b7e867a..fe42470 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1243,8 +1243,7 @@ dependencies = [ [[package]] name = "shopify_function_provider" version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1eb4e60eb2f8c6e02b1f1e7634ef91738b1104b5bc2fa30458d10cd00917dbbf" +source = "git+http://github.com/Shopify/shopify-function-wasm-api?branch=ap.cached-module-id-atomic-fix-2#9b0e932107556506e3abdd337d93c7c38b334165" dependencies = [ "bumpalo", "rmp", @@ -1254,10 +1253,10 @@ dependencies = [ [[package]] name = "shopify_function_wasm_api" version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a57a2e64ef7d28cbe26bf591fd084093327d9d359e38355010720d818cd92ba9" +source = "git+http://github.com/Shopify/shopify-function-wasm-api?branch=ap.cached-module-id-atomic-fix-2#9b0e932107556506e3abdd337d93c7c38b334165" dependencies = [ "rmp-serde", + "seq-macro", "serde_json", "shopify_function_provider", "shopify_function_wasm_api_core", @@ -1267,8 +1266,7 @@ dependencies = [ [[package]] name = "shopify_function_wasm_api_core" version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4842376f01b3abe6c78596085f29ea0d1b605873d2855f812738072c38e32c34" +source = "git+http://github.com/Shopify/shopify-function-wasm-api?branch=ap.cached-module-id-atomic-fix-2#9b0e932107556506e3abdd337d93c7c38b334165" dependencies = [ "strum", ] diff --git a/shopify_function/Cargo.toml b/shopify_function/Cargo.toml index 5c59731..89331cb 100644 --- a/shopify_function/Cargo.toml +++ b/shopify_function/Cargo.toml @@ -9,7 +9,8 @@ description = "Crate to write Shopify Functions in Rust." [dependencies] serde_json = "1.0" shopify_function_macro = { version = "1.1.0", path = "../shopify_function_macro" } -shopify_function_wasm_api = "0.1.0" +# shopify_function_wasm_api = "0.1.0" +shopify_function_wasm_api = { git = "http://github.com/Shopify/shopify-function-wasm-api", branch = "ap.cached-module-id-atomic-fix-2" } # Use the `small` feature of ryu (transitive dependency through serde_json) # to shave off ~9kb of the Wasm binary size. diff --git a/shopify_function_macro/src/lib.rs b/shopify_function_macro/src/lib.rs index c382691..e4d4136 100644 --- a/shopify_function_macro/src/lib.rs +++ b/shopify_function_macro/src/lib.rs @@ -349,8 +349,10 @@ impl CodeGenerator for ShopifyFunctionCodeGenerator { parse_quote! { #description pub fn #field_name_ident(&self) -> #field_type { - static INTERNED_FIELD_NAME: shopify_function::wasm_api::CachedInternedStringId = shopify_function::wasm_api::CachedInternedStringId::new(#field_name_lit_str, ); - let interned_string_id = INTERNED_FIELD_NAME.load_from_value(&self.__wasm_value); + thread_local! { + static INTERNED_FIELD_NAME: shopify_function::wasm_api::CachedInternedStringId = shopify_function::wasm_api::CachedInternedStringId::new(#field_name_lit_str, ); + } + let interned_string_id = INTERNED_FIELD_NAME.with(|interned_field_name| interned_field_name.load_from_value(&self.__wasm_value)); let value = self.#field_name_ident.get_or_init(|| { let value = self.__wasm_value.get_interned_obj_prop(interned_string_id);