This repository was archived by the owner on Aug 18, 2025. It is now read-only.
fix(Web): the generated entities does not compile for web platform#127
Open
danielgomezriconeon wants to merge 10 commits intoisar-community:v3from
Open
fix(Web): the generated entities does not compile for web platform#127danielgomezriconeon wants to merge 10 commits intoisar-community:v3from
danielgomezriconeon wants to merge 10 commits intoisar-community:v3from
Conversation
…rals - Replace compile-time xxh3 hash generation with runtime function generators - Add web-safe hash function that works across all platforms without large integers - Modify ObjectInfo, ObjectIndex, and ObjectLink to use idGenerator instead of id - Update schema generators to use function-based ID generation - Fixes issue isar-community#80 where apps including Isar couldn't compile for web BREAKING CHANGE: Schema objects now use idGenerator functions instead of static id fields
- Add idGenerator field to Schema, IndexSchema, and LinkSchema classes - Maintain backward compatibility with existing id field - Support both compile-time id and runtime idGenerator approaches - Update constructors to accept either id or idGenerator parameters
- Remove const from Schema, CollectionSchema, IndexSchema, and LinkSchema constructors - Change generated schema declarations from const to final - This allows idGenerator function expressions to be used in constructors - Fixes compilation errors with function expressions in const contexts
- Add web-safe hash function tests covering consistency, range limits, and distribution - Add object info generator tests for idGenerator string generation - Add schema backward compatibility tests for hash function behavior - Add regression tests to ensure no performance degradation - Add integration tests for web compilation scenarios (note: some disabled due to build_test compatibility issues) - Tests verify that generated code stays within JavaScript safe integer range - Tests ensure consistent ID generation across platforms - All core functionality tests pass successfully
- Add Makefile with organized command structure and help system - Include test commands for web compilation fix validation - Add development commands for deps, formatting, linting - Add cleanup and status commands for project maintenance - Default 'make' command shows help with all available commands - Specific commands: - make test: Run web compilation fix tests - make help: Display help message - make test-all: Run comprehensive test suite - make deps: Install dependencies - make format/lint: Code quality commands - make clean: Cleanup build artifacts Commands are organized by category with clear descriptions and examples.
2 tasks
- Reduce Makefile complexity to focus on core requirements - Keep only 'test' and 'help' commands as requested - Default 'make' command shows help message - 'make test' runs web compilation fix tests - Clean, simple interface with clear output formatting
- Change 'make test' to run all tests across all packages - Handle problematic tests with build_test dependency issues gracefully - Include working tests from isar_generator (web_safe_hash_test, object_info_test) - Include all tests from isar package - Attempt to run tests from isar_inspector and isar_test with fallback messages - Provide clear feedback when tests fail or are unavailable - Update help text to reflect that it runs all tests
|
thank you, I just test it and I finnally can run my project on web! |
Author
|
It works for web but I tried adding this on an android build via overrides and I get errors: pubdev.yaml dependencies:
// ...
isar:
version: 3.1.8
hosted: https://pub.isar-community.dev/
isar_flutter_libs: # contains Isar Core
version: 3.1.8
hosted: https://pub.isar-community.dev/
dev_dependencies:
// ...
isar_generator:
version: 3.1.8
hosted: https://pub.isar-community.dev/
dependency_overrides:
isar:
git:
url: https://github.com/NEONSCREENS/mobile-flutter-isar
ref: v3.0-web-fix-tmp
path: packages/isar
isar_flutter_libs:
git:
url: https://github.com/NEONSCREENS/mobile-flutter-isar
ref: v3.0-web-fix-tmp
path: packages/isar_flutter_libs
isar_generator:
git:
url: https://github.com/NEONSCREENS/mobile-flutter-isar
ref: v3.0-web-fix-tmp
path: packages/isar_generatorError: IsarError: Could not initialize IsarCore library for processor architecture "android_arm64". If you create a Flutter app, make sure to add isar_flutter_libs to your dependencies.
IsarError: Incorrect Isar Core version: Required 3.1.8 found 3.1.0+1. Make sure to use the latest isar_flutter_libs. If you have a Dart only project, make sure that old Isar Core binaries are deleted.
#0 initializeCoreBinary (package:isar/src/native/isar_core.dart:78:7)
#1 openIsar (package:isar/src/native/open.dart:81:3)
#2 Isar.open (package:isar/src/isar.dart:107:12)I think it is related to add add those as github references since it has some kind of internal builds (.so) |
Author
|
hey @vicenterusso ping |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes issue:
Done:
Caution
BREAKING CHANGE: Schema objects now use idGenerator functions instead of static id fields
Context
I saw some work over time but none of those worked for me: